• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

how to convert servlet output into pdf

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
then give me the link of google. if you know or give me some usefully site address
 
Rancher
Posts: 43045
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67694
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41502
881
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic