how to generate PDF and save a copy on client?
Moderator: General Moderators
-
vivekchopra
- Forum Newbie
- Posts: 4
- Joined: Thu Aug 04, 2005 8:41 pm
how to generate PDF and save a copy on client?
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
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
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
very nice pdf tool:
http://www.ros.co.nz/pdf/
http://www.ros.co.nz/pdf/
-
vivekchopra
- Forum Newbie
- Posts: 4
- Joined: Thu Aug 04, 2005 8:41 pm
CPDF from R&OS
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
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
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)
-
vivekchopra
- Forum Newbie
- Posts: 4
- Joined: Thu Aug 04, 2005 8:41 pm
will this help?
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
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
-
vivekchopra
- Forum Newbie
- Posts: 4
- Joined: Thu Aug 04, 2005 8:41 pm
thanks ..
Thanks ..
I will try it and post the results here ..
Thanks.
Vivek
I will try it and post the results here ..
Thanks.
Vivek
Java-based solution
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.