3

How to convert to PDF from my JSP/HTML file?.

I want to convert a particular part of my webpage to a PDF file. Is it possible?

Bill the Lizard
  • 386,424
  • 207
  • 554
  • 861
Gnaniyar Zubair
  • 7,816
  • 22
  • 58
  • 71
  • possible duplicate of [Converting HTML files to PDF](http://stackoverflow.com/questions/633780/converting-html-files-to-pdf) – Autar Sep 17 '15 at 14:28

5 Answers5

4

Yes. Take a good look at booth Apache FOP and iText. No matter what you use, you'll probably have to do a little fiddling.

Matthew Flaschen
  • 268,153
  • 48
  • 509
  • 534
2

I used HTMLDoc a couple of years ago and had pretty good luck with it.

Aleksandr Kovalev
  • 3,158
  • 3
  • 33
  • 35
yalestar
  • 9,104
  • 6
  • 39
  • 52
1

try wkhtmltopdf. It is a command line utility that can be provided an html file or web address and a save location for the pdf. Very easy to use and utilizes the same rendering engine as safari. Works MUCH better than many of the other parsers that I have used (that don't always support CSS and other advanced layout features.

jle
  • 9,058
  • 5
  • 47
  • 66
0

flying saucer library is the best one to use. It works on top of itext and makes the task of conversion very easy.

coder hacker
  • 4,700
  • 1
  • 24
  • 49
0

Take a look at html2ps (Perl) or html2ps (PHP). However, none of the two is implemented in Java.

You might also want to read this article.

joschi
  • 12,168
  • 4
  • 44
  • 49