I have requirement to convert a web page into pdf using java or javascript. This pdf should exactly look like print format of webpage. So basically I have to print the html webpage into pdf doc using java or javascript
-
Check this out. xmlgraphics.apache.org/fop or you can use iText itextpdf.com (commercial).CoolBeans– CoolBeans2010-12-07 21:12:28 +00:00Commented Dec 7, 2010 at 21:12
-
iText is available as APGL or a commercial license... not just commercial. Also, iText's HTML rendering isn't all that hot.Mark Storer– Mark Storer2010-12-07 21:38:27 +00:00Commented Dec 7, 2010 at 21:38
-
Implementing it urself might be too much work and I don't think there are any good free packages out there. But, you could use Applescript or programmatically access the print facility in Windows to achieve this end.euphoria83– euphoria832010-12-08 12:40:05 +00:00Commented Dec 8, 2010 at 12:40
Add a comment
|
2 Answers
I suggest wkhtmltopdf. It uses webkit to render HTML to PDF. Snazzy.
PS: "exactly" is a rather fickle concept in HTML. "Pixel perfect" simply won't happen.
Comments
Try http://code.google.com/p/flying-saucer/
But it is impossible to create an exactly equal looking pdf. There is no support for scrollabars in PDF. especially, if the PDF should be printed.