Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

iPhone: HTML to PDF conversion library?

Is anybody aware of a way to convert an html page to pdf in code that runs on the iPhone? I have gotten UIWebView to render into a pdf file, but that just creates a bitmap, I would really prefer a normal pdf, with selectable/searchable text.

I have a found a few libraries around for this, but so far mostly Java and .Net. Is there anything that could actually be embedded in an app? Preferably open source, but commercial might be ok as well.

Mac Pro

Posted on Nov 4, 2009 2:38 PM

Reply
7 replies

Nov 4, 2009 4:09 PM in response to Matt_F_Seattle

This is a great method....

http://www.macresearch.org/cocoa-scientists-xxx-developing-iphone

...once you have your PDF. Very slick. I adopted it and received gracious permission from Drew to use his example.

There are tons of ways to go from HTML to PDF....the simplest being print---PDF from Safari as an example. Adobe Acrobat used to have a feature that would let you set a URL with page depth and then it would go and crawl around and create a complete PDF on your computer...Adobe may still offer that as an online service right from their servers.

Nov 4, 2009 4:43 PM in response to sptrakesh

I have been googling (interestingly, "iphone html pdf library" is already bringing up this thread as the first hit, and not much else that looks relevant), and there are a variety of pdf libraries out there, but so far I have not found one that says it will run on iPhone (or looks to be generic C/C++) and that says it does the html to pdf conversion.

If you actually know of a specific one that does, please let me know.

Nov 4, 2009 4:49 PM in response to K T

The method described at http://www.macresearch.org/cocoa-scientists-xxx-developing-iphone is all about displaying pdf's on the iPhone (which are created elsewhere). I want to convert html into a pdf on the phone. I do not actually need to display the pdf at all (I can just display the html).

I have seen easy ways of doing the conversion in MacOS (using the same API used in printing to a pdf), but these do not appear to be available on the iPhone.

An online service from Adobe might be a possible approach, but it seems awfully sub-optimal to have to upload the html (and embedded images) and download back a pdf.

Nov 4, 2009 7:47 PM in response to Matt_F_Seattle

Honestly, I doubt you'd want to labor the device with this task - can you print reliably/directly/natively from your iPhone now....seems generating a PDF would include much of the same process.

Just make sure you're not looking to do something with the platform that it isn't meant for...at least as it stands now 🙂

Apple expects the iPhone to always be a phone, no matter what else is going on and if an app tries to bogart that priority, the OS won't hesitate to clip some wings.

iPhone: HTML to PDF conversion library?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.