title: How to get the Page count of doc/docx file which is shown in the UIWebView?
body: <p>I want to divide the word file into number of pages and stores into an array and when it required I wanted to show that specific page in to <code>UIWebView</code>. I have done the same thing for PPT but not able to do for word file. Here is my code for PPT.</p>
  
  <p>(1) Use <code>UIWebView</code> to display the content of the PPT. The well formed (!) HTML allows you to parse it. Get the html using</p>
  
  <pre><code>NSString *htmlContent = [self.webView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"];
  </code></pre>
  
  <p>(2) Count the number of div class = 'slide to get the slide count</p>
  
  <p>(3) You need to parse the HTML to get the styles and div using the below code</p>
  
  <p>(4) Get all the styles</p>
  
  <pre><code>- (NSString *)getStyles:(int)slideCount forView:(UIWebView *)view {
  
      NSString *getElementByTag = [[NSString alloc] init];
      NSString *allStyles = [[NSString alloc] init];
  
      for (int i = 0; i &lt; slideCount; i++) {
          getElementByTag = [NSString stringWithFormat:@"document.getElementsByTagName('style')[%d].innerHTML", i];
          NSString *style =  [[view stringByEvaluatingJavaScriptFromString:getElementByTag] stringByAppendingString:@"\n"];
          allStyles = [allStyles stringByAppendingString:style];
      }
  
      allStyles = [@"&lt;style type='text/css'&gt;" stringByAppendingString: allStyles];
  
      return [allStyles stringByAppendingString:@"&lt;/style&gt;"];
  }
  </code></pre>
  
  <p>(5) Concatenate all the styles from step 5 with div tag content. Define a <code>NSMutableArray</code> variable to to store all slides with styles for future reference. Define <code>NSMutableArray</code> *slides to store all the slides</p>
  
  <pre><code>- (void)makeSlides:(int)slideCount forView:(UIWebView *)view {
  
      self.slides = [[NSMutableArray alloc] init];
  
      for (int i = 0; i &lt; slideCount; i++) {
          NSString *slideBody = [NSString stringWithFormat:@"document.getElementsByClassName('slide')[%d].innerHTML", i];
          NSString *div = [view stringByEvaluatingJavaScriptFromString:slideBody];
  
          NSString *slide = [self.slideStyles stringByAppendingString:div];
          [self.slides addObject:slide];
      }
  }
  </code></pre>
  
  <p>Like that i want to do the same thing for word document. Please do needful for me.</p>
  
  <p>I have take reference of this link.
  <a href="https://stackoverflow.com/questions/15971969/ios-library-to-convert-powerpoint-presentations-into-images/18129059#18129059%E2%80%8B">IOS library to convert powerpoint presentations into images</a></p>