File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Generate PDF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Generate PDF" Watch "Generate PDF" New topic

Generate PDF

Rekha Pande
Ranch Hand

Joined: Jan 29, 2004
Posts: 145
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

Joined: Jul 14, 2001
Posts: 67
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:

The Eagle sneers at the Peacock<p>Systems Administrator<br />OrderWare Solutions Ltd<br /><a href="" target="_blank" rel="nofollow"></a>
bart zagers
Ranch Hand

Joined: Feb 05, 2003
Posts: 234
We use iText to generate simple pdf files of the different lists of our web applications.
Sudhir Meduri

Joined: May 28, 2003
Posts: 22
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


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

Thanks,<br />Sudhir <br />SCJP1.4
I agree. Here's the link:
subject: Generate PDF
jQuery in Action, 3rd edition