Meaningless Drivel is fun!
The moose likes Servlets and the fly likes Response Output as PDF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Response Output as PDF" Watch "Response Output as PDF" New topic

Response Output as PDF

Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
How to write the response output as PDF. I tried with the following code.

There was no error (or) Exception in Tomcat server. But the FireFox browser is saying

File does bor begin with '%PDF--';

Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

To send the response as a pdf, you would first need to generate a PDF.
Try a Google search for "Apache FOP" or "itext" to find some libraries for generating PDFs.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Thanks Ben
jiju ka
Ranch Hand

Joined: Oct 12, 2004
Posts: 306
Itext is memmory centric. If memmory is a constraint FOP is a beeter choice.
iText is easy to configure and use. For bigger applications FOP is prefered.

Another tool is FDF toolkit. Which also have limitations.
I agree. Here's the link:
subject: Response Output as PDF
It's not a secret anymore!