Page 1 of 1

how to generate PDF and save a copy on client?

Posted: Thu Aug 04, 2005 8:55 pm
by vivekchopra
I have a hardcopy PDF form and now I want to create an applicant which reads data from database and fills the PDF form. Users should be able to save this filled form.

I have tried one method. I created a PDF form (with defined text fields) and I generate a FDF file using information from the database. When a user clicks on download, the FDF populates the PDF form and displays to the user.
Problem: User sees a completed form but can't download the COMPLETED form. In this case, I am able to print the completed form or download the original form (without any data filled in) but not able to download the completed form.

If I use CPDF library then I need to specify each fields' dimensions and position which is a pain because the number of fields is very high and I need to do a few forms.

Whats the best way to approach this problem? I want to create a PDF from Database and allow user to save it as well.

Any help is appreciated.

Vivek

Posted: Thu Aug 04, 2005 9:10 pm
by feyd
very nice pdf tool:
http://www.ros.co.nz/pdf/

CPDF from R&OS

Posted: Thu Aug 04, 2005 9:25 pm
by vivekchopra
Hey Feyd,

Thanks for your reply. I have tried using this library as well. As I mentioned in previous post,
"If I use CPDF library then I need to specify each fields' dimensions and position which is a pain because the number of fields is very high and I need to do a few forms."

The problem with using this library is that I need to give the coordinates and dimensions of each text field/image/background image in the PDF form that it becomes very messy code for each form as I need to match it against the hardcopy of PDF form.

And considering that I have to do different kinds of forms, the task gets very mechanical.

Is it possible to open an existing PDF file using this library? And then add my contents on the required fields? That would be the ideal solution for me. Let me know if it supports this functionality.

Vivek

Posted: Thu Aug 04, 2005 9:30 pm
by feyd
fpdf can open an existing pdf, however if you use the ezPDF extension it's quite simple to create quite complex pdf's...

Posted: Thu Aug 04, 2005 9:32 pm
by nielsene
If you know LaTeX, I like to have my PHP scripts output a LaTeX source file that I then run through pdflatex using exec. You'll probably have to build a lot of you own "helper" code to properly escape the different special characters, but otherwise it makes layout a snap. (If you already know LaTeX..... if you don't, its probably not the easiest approach)

will this help?

Posted: Thu Aug 04, 2005 9:50 pm
by vivekchopra
Hi, I just came across this post

viewtopic.php?t=30157

And I also need to fill an existing PDF. Do you think the above post should help me with it?

Vivek

Posted: Thu Aug 04, 2005 9:59 pm
by feyd
it could... it doesn't really hurt to try it..

thanks ..

Posted: Thu Aug 04, 2005 10:02 pm
by vivekchopra
Thanks ..

I will try it and post the results here ..

Thanks.
Vivek

Java-based solution

Posted: Tue Sep 13, 2005 6:04 am
by egreene
Anyone had any success integrating Java with PHP? The best "free" solution I've found for flattening form data on a PDF is IText (http://www.lowagie.com/iText/) but it is java based. If you can integrate Java with PHP it is the best tool to use. Otherwise you will have to use a server-based workaround (keep data in database and retrieve on every "request") like I do with formGenie. See website below.