Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can a servlet convert a html page into pdf

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can a servlet convert a html page into pdf document?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With a 3rd party library that does so. I'd search for something like java pdf generation.
 
Tim Moores
Bartender
Posts: 2803
41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the HTML is actually CSS-styled XHTML, then the FlyingSaucer library can help. Otherwise, OpenOffice in server mode might do, possibly via a library such as JODConverter.
 
Ernesto Arroyo
Greenhorn
Posts: 11
Java Objective C Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question in not really clear: the servlet does not convert anything. The servlet "composes" the response and this response can be HTML, PDF or any other MIME format.

The conversion you need can be done with multiple libraries but instead of a servlet...
what about a filter that converts the output of an HTML response (maybe prepared by a JSP)??

It's only an idea
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, my requirement is that i have to provide a pdf cnversion facility in Formulae.html(mathematics). That html is just informative. If the user clicks pdf conversion link, it will cnverts the contents of html into pdf.
 
Ernesto Arroyo
Greenhorn
Posts: 11
Java Objective C Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you were generating XHTML you could easily convert to PDF with... ¿XSL-FO? (not sure about this acronym).

Google for FOP (Formatting Object to PDF) or http://xml.apache.org/dist/fop/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic