Tejas
Tejas

Reputation: 272

print webpage into pdf file using java or javascript

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

Upvotes: 2

Views: 2855

Answers (2)

Christian Kuetbach
Christian Kuetbach

Reputation: 16060

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.

Upvotes: 0

Mark Storer
Mark Storer

Reputation: 15890

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.

Upvotes: 1

Related Questions