views:

964

answers:

2

In my iPhone application I'm generating an HTML file. I would like to convert that HTML file to a PDF file programatically. The PDF will then be attached to an email.

Does anyone know (have an example) how to convert the HTML file to a PDF?

A: 

I was looking into this as well, and could not find a way. I was hoping to find an existing C or C++ library that could do the conversion that would run on the iPhone, but I could not find one. Please let me know if you do.

You can actually take the screen image out of a UIWebView and write that to a pdf, but it ends up as a small low-res bitmap, so not very useful.

Also note that there is a huge bug with the iPhone sdk's handling of text in a pdf. Basically the pdf's it produces work great on a mac and the iPhone, but are not technically valid, and will not necessarily render properly everywhere. See this post for a summary: http://www.iphonedevsdk.com/forum/iphone-sdk-development/15505-pdf-font-problem-cant-get-cids-glyphs.html#post97854

Pmatt