title: some problems about html to pdf in iOS
body: <p>Recently i'm trouble in some problems about html convert to PDF files. 
  I find use the followed method to convert is not quickly enough and the PDF files created are big (the file size is about 2M - 5M / 7 pages ) . And some html pages are inconsistent with the converted PDF files.
  Are there any methods to control the pdf size?
  Are there any methods can convert it more quickly?
  Are there any methods can solve the pdf files be inconsistent with the html pages in webview ?
  I would very much appreciate your help. Thank you.</p>
  
  <pre><code>- (NSData*) printToPDF
  {
      NSMutableData *pdfData = [NSMutableData data];
  
      UIGraphicsBeginPDFContextToData( pdfData, CGRectZero, nil );
  
      [self prepareForDrawingPages: NSMakeRange(0, self.numberOfPages)];
  
      CGRect bounds = UIGraphicsGetPDFContextBounds();
  
      for ( int i = 0 ; i &lt; self.numberOfPages ; i++ )
      {
          UIGraphicsBeginPDFPage();
  
          [self drawPageAtIndex: i inRect: bounds];//
      }
  
      UIGraphicsEndPDFContext();
  
      return pdfData;
  }
  </code></pre>