PDF's and DB's
| From: | Mark McCray | Date: | Tue, 08 Aug 2000 01:13:01 +0000 |
| Subject: | PDF's and DB's | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-1841@lists.php.net to get a copy of this message | ||
Hey everyone,
I posted a question a little while ago asking how you can get information
from a database into a PDF via a web browser. Well, I've figured it out. So
I thought I'd share the wealth.
1. You have to have Acrobat and be able to use it to create forms in a PDF.
We took the W4 form from the tax web site and used it because it already had
fields created in it.
2. You have to create an FDF file. This is a Acrobat Forms Definition file.
The format of the file is not that hard to figure out. You can get
reference for it by going to the Adobe Website.
The FDF file that you create really is only a text file in a specific
format. So you could use PHP to query the database for the information
needed to fill out the form. Then open a file handle and spit out the FDF
information interspersed with the database information. Just like you would
display information from a database on a page, you would just echo it to the
file.
3. Once you've created the file successfully, you can just give them a link
to click which will bring them to the the FDF file you just made.
4. The trick in getting the FDF file to populate a specific PDF file is
in the '/F' tag in the FDF file. The /F tag lets you specify which PDF file
you want to import your FDF file into. And lo and behold, it lets you link
to a web server.
For example, I've created an FDF file called w4import.fdf. I've created a
link that will ask to display this FDF file. Within the FDF file I've told
it to open a PDF at http://www.webserver.com/w42000.pdf. As long as you
have the PDF Viewer plug-in installed and you've also created a mime type
that you web server hands out and your Web Browser understands, then the FDF
file will open the PDF file and viola. Your PDF will be filled out on
screen.
You should check out this link as it has the documentation that you'll need.
http://partners.adobe.com/asn/developer/acrosdk/forms.html
Enjoy!
Marky