I started with this tutorial on creating pdf's on the iPhone...
Then I took out the code there for drawing into the pdf, and replaced it with this:
// PDF page drawing expects a Lower-Left coordinate system, so we flip the coordinate system
// before we start drawing.
CGContextTranslateCTM(pdfContext, 0.0, pageRect.size.height);
CGContextScaleCTM(pdfContext, 1.0, -1.0);
// webView is my UIWebView component
[webView.layer renderInContext:pdfContext];
But this creates a very small bitmap, i.e. the size of the iPhone screen. I have been experimenting with setting the frame of the UIWebView to be much larger, as well as with making the mediaBox parameter of the pdf (the &pageRect in the tutorial sample) larger, but I have not had success in generating a large bitmap of a complete html page.
But really, bitmap just seems like a bad approach. For the text to be readable (and print well) on a desktop, the bitmap would have to be extremely high resolution. Even if I could get it to work, it seems like I might run into memory and file size issues. A "real" pdf with selectable, scalable text would be far better.
I have gotten a few responses on this topic on the Apple developer forum, but nothing really solid...
It looks like this is the best of the commercial html to pdf converters...
I am currently in an email dialog with somebody from that company about them possibly porting their library to iPhone (they already have MacOS and variety of unixes). But it is not yet clear how feasible that would be for them, or how much licensing would be. But I will introduce you to him in a separate email.
-- Matt