0

I want to create PDF with proper format like proper text and image would be on proper format like normal PDF file. I know how to create PDF with image and text but I don't know how to format it & I also know that PDF can be converted from HTML by displaying it's content on webview and capturing its screen in image and converting it into PDF. But is there any another way or any tag available like HTML. Or is there any third party tool available for this issue.

iProgrammer
  • 3,099
  • 3
  • 33
  • 59
Aakil Ladhani
  • 984
  • 9
  • 32
  • Wait, you know how to create a pdf with images and text; but not how to format it? What format are you trying to achieve? Can you be more specific? – FluffulousChimp Mar 21 '12 at 13:16
  • actully like html tag such in proper format – Aakil Ladhani Mar 21 '12 at 13:28
  • Oh, going directly from HTML markup directly to pdf? I know of no way without resorting to private API's. For a private API approach, see the last answer to [this question](http://stackoverflow.com/questions/4356436/generating-a-pdf-using-the-new-printing-stuff-in-ios-4-2) – FluffulousChimp Mar 21 '12 at 13:46
  • @alanduncan thnx but what are other ways? – Aakil Ladhani Mar 23 '12 at 05:33
  • You could, as you mentioned in your question, convert your `UIWebView` content to a PDF. Alternatively, you could layout a view in a nib in a format that resembles the PDF you wish to generate, then populate the nib and then draw it to a PDF. – FluffulousChimp Mar 23 '12 at 13:48

1 Answers1

0

You can create a PDF drawing contect with CGPDFContextCreate and then draw with standard Cord Graphics 2D functions as you would draw on the screen. See also this question: iOS SDK - Programmatically generate a PDF file

Community
  • 1
  • 1
MrTJ
  • 13,064
  • 4
  • 41
  • 63