views:

20630

answers:

8

Does anyone know if it is possible to convert a HTML page (url) to a PDF using itext? If the answer is 'no' than that is OK as well since I will stop wasting my time trying to work it out and just spend some money on one of a number of components which I know can :) Thanks in advance for your responses!

+1  A: 

Somewhat. http://itext.ugent.be/library/question.php?id=40

Daniel A. White
Thanks for the super fast reply.I will take that answer as yes but probably buy something better suited.Since I am using .NET and wont use the Java version of itext this is probably even more the case.Thanks again.
Mark
The link is dead...
Damien B
+3  A: 

It doesn't appear to be very good for converting HTML.

I have been testing with iTextSharp for a bit because I have a nicely formatted HTML page that I want to convert to a PDF. I first tried it with an XmlTextReader and HtmlParser.Parse, and am now trying it with simpleparser.HTMLWorker. At first I thought my PDF was badly formatted because of the CSS, but even without CSS it looked bad. I could rebuild my document piece by piece and get it to work with iTextSharp, but need to learn more about how to do that. Another temporary option I am considering is to have a user print the HTML page to a PDF and upload it to the website. It's something that does not change very often.

Here's a recent link I found when looking for more about this, http://hamang.net/2008/08/14/html-to-pdf-in-net/

Search this forum for "HTML": http://www.nabble.com/iTextSharp-f4188.html

It contains some interesing things like mentioning that HTML to PDF conversion is crude, and that the HTMLWorker class was made to use HTML fragments, but does not work well with nested containers.

Bratch
+4  A: 

I have ended up using ABCPdf from webSupergoo. It works really well and for about $350 it has saved me hours and hours based on your comments above. Thanks again Daniel and Bratch for your comments.

Mark
A: 

When I needed HTML to PDF conversion earlier this year, I tried the trial of Winnovative HTML to PDF converter (I think ExpertPDF is the same product, too). It worked great so we bought a license at that company. I don't go into it too in depth after that.

Mark
A: 

http://www.easysw.com/htmldoc/

Tyler
A: 

Maybe you could try:

http://www.allcolor.org/YaHPConverter/

+7  A: 

I think this is exactly what you were looking for

http://today.java.net/pub/a/today/2007/06/26/generating-pdfs-with-flying-saucer-and-itext.html

https://xhtmlrenderer.dev.java.net/

Flying Saucer's primary purpose is to render spec-compliant XHTML and CSS 2.1 to the screen as a Swing component. Though it was originally intended for embedding markup into desktop applications (things like the iTunes Music Store), Flying Saucer has been extended work with iText as well. This makes it very easy to render XHTML to PDFs, as well as to images and to the screen. Flying Saucer requires Java 1.4 or higher.

opensas
A: 

but how to render the modification made by javascript in html and css??? the header and footer?

Adry