File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes how to convert servlet output into pdf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "how to convert servlet output into pdf" Watch "how to convert servlet output into pdf" New topic
Author

how to convert servlet output into pdf

Ravii Bhai
Greenhorn

Joined: Dec 13, 2008
Posts: 10
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

Joined: Mar 28, 2007
Posts: 403
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>


Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
Ravii Bhai
Greenhorn

Joined: Dec 13, 2008
Posts: 10
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

Joined: Jan 28, 2008
Posts: 5575

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

Joined: Dec 13, 2008
Posts: 10
then give me the link of google. if you know or give me some usefully site address
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
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

Joined: Jan 10, 2002
Posts: 61774
    
  67

"argent"? I assume you meant "urgent". In any case, please read this for information on why that's not a good idea.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31085
    
163

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Edwin Stephens
Greenhorn

Joined: Dec 30, 2008
Posts: 15
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to convert servlet output into pdf