Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generate PDF

 
Rekha Pande
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi..
I have this jsp page which i want to send as an attachment in PDF format .. is that possible....

What i want to do is that when i click on a button i want the jsp page that is displayed to be converted into pdf and then send it as an attachment through email or save that attachment on the hard disk.

Is this possible???... please can some one help me out on this one.. and please do give some code also...

Any help would be appreciated quite a lot

Thank you
 
Karl Laird
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can have your output page in well formed xHTML (rather than straight HTML) then using something like cocoon with FOP is probably one of your best bets (especially if you're already using Tomcat?).

Check out the links below:
http://cocoon.apache.org/2.1/howto/howto-html-pdf-publishing.html
http://xml.apache.org/fop/
 
bart zagers
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We use iText to generate simple pdf files of the different lists of our web applications.
 
Sudhir Meduri
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use apache FOP it's nice & cool

As mentioned in the previous post if u have xml or well formated html then that is so easy

XML--> XSL-FO--->PDF

once you have XSL-FO try to use it as a template in the jsp
meaning instead of html.
try change the content type to application/pdf and pass this XSL-FO jsp stream to FOP API's and u will get a PDF.

pls let us know how did it go
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic