File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes PDF generation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "PDF generation" Watch "PDF generation" New topic

PDF generation

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 980
Hi all,

Not sure..where to post this...

In a web can i have PDF's created and saved in the Database and then read it later from the database.

Any tips..would be welcome.

Currently am thinking of using a BlOB field for this...Am i right...

Thanks & Regards
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

What part of this do you need help with -- creating PDFs, or storing them in a database?

[Jess in Action][AskingGoodQuestions]
Frank Ertl
Ranch Hand

Joined: Apr 25, 2005
Posts: 59
Try apache's FOP to generate pdf (It can be found on the apache website).
santosh kulkarni

Joined: Jul 21, 2004
Posts: 18
Try , I recently used it with success.

Base64 encoding will allow you to store it in a text field if you prefer.
[ December 05, 2005: Message edited by: santosh kulkarni ]

Impossible is not a fact its an opinion
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 980

Thanks for all the replies..

I will tell you my requirement.Actually i have to show information as a Pdf for the users of the application.

So i have 2 options.

Either the admin will generate his contents as a PDF and I have to store them in the database and retrieve it back for the clients in their browser.


I have to ask him to upload the contents into the Database plain text/images and then generate the PDF from these data for the clients to view in their browser.

Also these PDF's in the browser should be copy-disabled.

How should I solve this..Which is the better one and whats the procedure to go about..?

A Kumar
Preetham Chandrasekhar
Ranch Hand

Joined: Nov 05, 2003
Posts: 98 works like a gem for the 2nd option....u can store the plain old pdfs in ur db and the 'iText' has methods to parse thru the pdf fields in the pdf and enter values on the fly into the pdf.

"In theory, there is no difference between theory and practice. But, in practice, there is."<br /> - Jan L.A. van de Snepscheut
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 980

Thanks for the reply..

In your mentioned that itext works fine for the second method...

Then how about the first one...

And among these 2 which is the better one...What do you suggest..??

Thanks in advance..
Reddy Ram

Joined: Jun 01, 2005
Posts: 1
Hi Kumar,

if you want dispaly DATA in PDF format to end user and that should stored in Database right?

There is solution for that, Thats called Apache Cocoon framework, using this you can achive your requirement.

Its one of web framework like Struts........

I thinks this description sloves your problem. right?

[ December 07, 2005: Message edited by: Reddy Ram ]

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 980
Hi Ram...

I am yet to start of development..its still in design stage..

so am not to go about it..

Will check on the framework...

Thanks & regards
A Kumar
jiju ka
Ranch Hand

Joined: Oct 12, 2004
Posts: 306
In a previous project I compared Apache FOP and iText. FOP is better for larger projects, less memory intrinsic, large pdfs, suitable for web applications. In this same application when we used iText the application became very slow.

I will recommend performance testing on whatever tool you choose for web access. It will be better if you can design the application such that the "pdf generating tool" can be switched if needed.

The copy aspect of the pdf can be disabled using both the tools. Itext is simple to use. Apache FOP is more popular. It is more generic and could be an industry standard in future.

[ December 07, 2005: Message edited by: jiju ka ]
[ December 07, 2005: Message edited by: jiju ka ]
Mahesh Sethi

Joined: Nov 30, 2005
Posts: 6
I have a similar project on which we used JAXB API along with XSL to render database results in form of pdf files. Certainly, it will require an understanding of XML/XSLT, but it gives you good control over the report template/format

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 980

I didnt knew that there were these many options for generating PDFs..I will have to have a close look at all of them before deciding..

Thanks all for your suggestions...

A Kumar
[ December 07, 2005: Message edited by: A Kumar ]
I agree. Here's the link:
subject: PDF generation
It's not a secret anymore!