This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes Response Output as PDF Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Response Output as PDF" Watch "Response Output as PDF" New topic
Author

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
Sheriff

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: 302
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: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Response Output as PDF
 
Similar Threads
Response as PDF
Returning large PDF file causing the server to crash.
Problem in writing concatenated byteArray to a PDF file
Pdf opens blank in browser
Trying to generate Large PDF in servlet