Skip to content

ActiveArchitexture/FDF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FDF: Adobe Acrobat Form Example

This project demonstrates using the FDF Toolkit for Java to extract form fields and values from a PDF form.

It assumes the PDF has been created using Adobe tools to create a PDF form. See:

Creating and distributing PDF forms in Adobe Acrobat

This project uses two tools in sequence:

  1. PDFtk Server to get an FDF file from a PDF
  2. FDF Toolkit for Java to get form fields and values from an FDF file

1. PDFtk Server

We will use the PDFtk Server to generate an FDF file from the PDF.

The PDFtk Server is part of PDFtk - The PDF Toolkit from PDF Labs run by Sid Steward, who is also the author of PDF Hacks (O’Reilly).

Steps

1 A. Download and install or compile

PDFLabs provides PDFtk Server installers for Windows, macOS, Red Hat Enterprise Linux and CentOS.

You can compile PDFtk Server from its source code.

Many Linux distributions provide a PDFtk package you can download and install using their package manager.

Install workaround for macOS

The installer for macOS from PDFtk Server does not produce any output for many commands.

The workaround is to download the latest version - not listed on the official website.

Thanks to PDFtk Server Install Workaround for Mac OS X and stackoverflow pdftk-hanging-on-macos-sierra.

1 B. Generate FDF from PDF

The format of the command to generate FDF from a PDF is:

pdftk INPUTACROFORM.pdf generate_fdf output EXTRACTEDFDF.fdf

For example:

pdftk SecuritySearchForm.pdf generate_fdf output extract.fdf
pdftk SecuritySearchFormSubmitted.pdf generate_fdf output extractSubmitted.fdf

Documentation

PDFtk features are fully documented on its man page. There are also some command-line examples.

PDFtk Server Commercial Support PDFtk Server Redistribution License

Consult PDFLabs for PDFtk Server Commercial Support and PDFtk Server Redistribution License terms.

2. Use the FDF Toolkit for Java to get the form fields and values from the FDF file

We will use the Acrobat Forms Data Format (FDF) Toolkit.

Steps

2 A. Include FDF Toolkit for Java in the Classpath

This project contains the FDF Toolkit for Java downloaded from FDF Toolkit for Java (ZIP: 2.2MB).

Include [jFdfTk.jar](FDF Toolkit for Java/Headers and Libraries/Java/jFdfTk.jar) in the Classpath.

Note: The terms as stated in the FDF Toolkit End User License Agreement.

2 B. Run ExtractFields.java

Compile and run ExtractFields.main() from src/ExtractFields.java.

Output:

fieldName: NAME	fieldValue: VALUE
...

Downloading the FDF Toolkit

Note: By downloading these files, you agree to the terms as stated in the End-User License Agreement included below.

FDF Toolkit End User License Agreement (PDF, 48k)

FDF Toolkit for Windows (ZIP: 2.2MB)

FDF Toolkit for Java (ZIP: 2.2MB)

FDF Toolkit for Unix (ZIP: 2.9MB)

Other approaches

iText

iText 7 Community, an open source PDF engine to create your smart document workflow.

API documentation for creating PDF solutions | iText Developers

Overview (iText 7 7.1.2 API)

http://itextsupport.com/apidocs/itext7/latest/com/itextpdf/forms/PdfAcroForm.html

Repository

ActiveArchitexture/FDF: Adobe Acrobat Form Example

Releases

No releases published

Packages

No packages published

Languages