• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Create a Pdf file using Java

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Saloon Keeper
Posts: 28486
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic