Adobe Acrobat FDF files

B

Bill Murphy

Adobe PDF files that allow the user to fill in the fields can also export
the field contents to an FDF (Forms Data Format) text file. These files can
then later be imported into a PDF file to populate the blank fields. I
would like to be able to create these FDF files in Access using data stored
in tables. I've viewed these text files and they have a lot of weird
formatting using special characters.

Has anyone experimented with creating these files in VBA from Access stored
data?

Bill
 
B

Bill Murphy

After some further experimentation I discovered that the FDF text files that
store the data for the PDF files can be pretty easily created in VBA using
data stored in Access tables. Each FDF has a standard header and a standard
footer that can be stored in memo fields. Each field in the PDF form can be
stored in a column in the table, along with a corresponding field number
that can be determined from the PDF after doing a manual export to a FDF
file. There appear to be only two types of fields - checkboxes and text
fields. Checkboxes are either Off for not checked or Yes for checked, and
surrounded with special characters like:

<< /V /Yes /T (c2-15)>>

Text field contents are stored surrounded by parentheses along with some
special characters, like:

<< /V (Houston) /T (f1-8)>>

The standard footer contains the PDF file name, along with two unique
alpha-numeric identifiers enclosed within greater than/less than symbols.
The first unique identier appears to identify the exact PDF file and is
constant, and the second appears to relate to a session using this PDF since
it varies each time. The second one should be nulled out to avoid getting
an error message:

/F (MyPDF.pdf)/ID [ <10ca32c604330f0c10901cf1e05af81><>

Some sample code to create the FDF text file using data stored in a table:

dim db as database
set db = currentdb
dim rst as recordset
dim fs as object
dim A as object

set rst = db.openrecordset("qryTestFDF", dbopendynaset)

rst.movefirst

set fs = CreateObject("Scripting.FileSystemObject")
set A = fs.CreateTextFile("c:\myPDFs\test.fdf", True)

A.writeline (rst!header)

(use a loop to fill all the data fields - the order doesn't seem to matter)
A.writeline (rst!firstfield)
A.writeline (rst!secondfield)
etc.
(end of loop for each field in the form)

A.writeline (rst!footer)

A.close

rst.close
set db = nothing
set rst = nothing
set fs = nothing
set A = nothing

The resulting FDF text file can be imported into the PDF and will fill all
the fields.

Hope this is helpful.

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top