• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to convert servlet output into pdf

 
Ravii Bhai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to convert servlet output into (pdf) pl z if possible give me sample code of servlet and steps also... its argent
[ December 26, 2008: Message edited by: Bear Bibeault ]
 
ujjwal soni
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ravi,

Do you mean the out.println part ? If yes then you can do this by setting the response type setting as like Response.ContentType="application/pdf"

Cheers!!!

Ujjwal B Soni

<ujjwalbsoni20032003@yahoo.com>
<919998971048>
 
Ravii Bhai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no not only sending part I am not getting external settings also.....
ok i sented response type text/pdf but what about next... please give me complete. details... and sample code if possible also... thank you
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ravii Bhai:
please give me complete. details... and sample code if possible also...


you can get sample code in Google .
 
Ravii Bhai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
then give me the link of google. if you know or give me some usefully site address
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What format is the "servlet output" in? If it's XHTML, you may be able to use the "flying saucer" library (somewhere on dev.java.net). If it's something else, tell us the details. Either way, much more work is going to be involved than setting the response type to PDF.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"argent"? I assume you meant "urgent". In any case, please read this for information on why that's not a good idea.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34870
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ravii Bhai:
then give me the link of google.

The literal answer to this is www.google.com. I don't think that's what you meant to ask.

iText creates PDF output if you have the data in Java and want to render it directly in PDF.
 
Edwin Stephens
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ravii,

The iText library (homepage http://www.lowagie.com/iText/) is a great library for generating PDFs via Java.

An example of using iText to generate a PDF file can be found at http://www.avajava.com/tutorials/lessons/how-do-i-write-to-a-pdf-file-using-itext.html.

An example of serving up a PDF file from a servlet can be found at http://www.avajava.com/tutorials/lessons/how-do-i-serve-up-a-pdf-from-a-servlet.html.

If you want to generate PDF content to be served up directly through a servlet with no intermediary file in the file system, this can usually be accomplished by writing the generated PDF content to the output stream of the servlet directly rather than writing to a file output stream. Elliotte Rusty Harold's Java I/O book is a great resource for understanding streams.

Hope that helps,
Edwin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic