wood burning stoves 2.0*
The moose likes Servlets and the fly likes Create a Pdf file using Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Create a Pdf file using Java" Watch "Create a Pdf file using Java" New topic
Author

Create a Pdf file using Java

mahadevan raja
Ranch Hand

Joined: Apr 11, 2001
Posts: 96
hi all,
i had already posted a query regarding how to print the contents,but in vain no reply,
can anybody tell me is there any class so as to create a pdf file and methods used to write into the pdf file.
IOStreams,do create a pdf file,but me not able to open the pdf file.
I saw a PdfWriter class,but not in sun specifications
so anyone plz help me how to create and write to a pdf file.
thanx in advance.


SPECIALIST-WCSV5.1 Implementation.<br />SYSTEMS EXPERT-WAS4.0 Administration
Frank Daly
Ranch Hand

Joined: Mar 31, 2000
Posts: 139
The following article from javaworld might help you.
http://www.javaworld.com/javaworld/jw-10-2000/jw-1020-print.html?
However you can also generate pdf files using xml, xsl:fo and cocoon which is a servlet available from apache.
Frank
Joe Gilvary
Ranch Hand

Joined: May 11, 2001
Posts: 152
Another related option is to use the FOP from
Apache. It is the same code that Cocoon uses
to generate PDF output. But if you do not need
all of the functionality of Cocoon, using just
FOP might be a solution.
There is a release candidate for FOP available
at the apache site,
http://xml.apache.org/dist/fop
for download. I have been using it for a project
that really does not require all of Cocoon.
HTH,
Joe
senthil narayan
Greenhorn

Joined: Jan 25, 2002
Posts: 13
Instead of using coocon to generate i think the foll is easy.
go to www.lowagie.com.
Tool name is :itext.
It's easy to generate pdf using this tool.
Sergio Glez
Greenhorn

Joined: Jan 09, 2002
Posts: 1
Hi! That class that you say (PdfWriter) is a part of a tool called StyleReport.
StyleReport is a reporter tool that can generate PDF, excel or HTML files.
It isn�t part of sun classes. You must by the StileReport in the next link:
http://www.inetsoftcorp.com
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

Also there's gnujpdf (formerly retepPDF) on sourceforge.net. It mimics the Java printing subsystem. It does OK for lightweight printing requirements, though intense graphics may be beyond it.
BTW There's a pitfall in printing PDF's. If you don't set the Content-length header to the size of the generated PDF, some versions of Netscape won't be able to display it properly.
Unfortunately, since the size of a PDF isn't easy to determine in advance, this has forced me to write the PDF to a temporary file just to get its length, output the HTTP headers, then spool out the temp file to the HTTP output stream.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
wood burning stoves
 
subject: Create a Pdf file using Java