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
  • 398,270
  • 210
  • 566
  • 880
Gnaniyar Zubair
  • 8,114
  • 23
  • 61
  • 72
  • 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
  • 278,309
  • 50
  • 514
  • 539
2

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

Aleksandr Kovalev
  • 3,508
  • 4
  • 34
  • 36
yalestar
  • 9,334
  • 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,316
  • 5
  • 48
  • 67
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,819
  • 1
  • 25
  • 50
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,746
  • 4
  • 44
  • 50