2

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

3
  • Check this out. xmlgraphics.apache.org/fop or you can use iText itextpdf.com (commercial). Commented 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. Commented 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. Commented Dec 8, 2010 at 12:40

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.