views:

55

answers:

2

I am trying to understand what the process is of turning HTML into a PDF/Postscript programmatically

All Google searches turn up libraries to do this, but I am more interested in the actual process required.

I know you could just set up a Postscript printer and print directly to that, but some of these libraries appear to create the PDF on the fly to allow previews etc.

has anyone had any experience in this, or can provide any guidance?

A: 

Yes! Try this: http://code.google.com/p/wkhtmltopdf/ . If you are interested in writing one, read it's code. It's dead simple to render to PDF/PS/PNG/JPEG.

Read these: http://doc.qt.nokia.com/4.6/qwebframe.html#render & http://doc.qt.nokia.com/4.6/qpainter.html

I've used qwebframe & qpainter in my HTML to PDF/PNG/JPEG program. It works like a charm! Stick with wkhtmltopdf if you are lazy to code.

Viet
Am I right in saying that as this uses the Webkit framework it won;t be support in IE(x)??
Dean
You can write a plugin to IE. Btw, just grab IE window handle and paint it in an image/PS. The way aforementioned solutions do is the same: Instead of painting to the screen, paint to an image/memory buffer/PS/PDF file.
Viet
A: 

I ended up using iTextSharp for this, which worked extremely well

Dean