Patagames Blog

How to use FDF (Forms Data Format)

What is FDF?

FDF is a file format for representing form data and annotations that are contained in a PDF form. It is a simplified file format based on the Adobe PDF document format. It allows creating form data, submitting structured form data to a server, receiving a response from the server and populating the form (in a PDF document) with the inquiry result.

Simply put, FDF is a tool to manipulate forms used in PDF documents.

Typical usage scenarios

From the very nature of the FDF format come its usage scenarios. You see, FDF is designed to provide interaction with specific data linked to a given PDF file but independently from that PDF file.

1. Form filling.

You can fill PDF form data from within the application, or export the data contained in the existing PDF file. A typical scenario could look as follows.

A company sends a PDF to a client, he fills the PDF form and now should send the data back to the company. Now, instead of sending the whole 50MB PDF file, he exports the form data to FDF and sends the form only. The company then incorporates this FDF to the source PDF file and receives a document (agreement, for example) filled with specific user data.

Surely, the process can be easily automated.

2. Online form processing.

Similarly, you can use a server script to process user-submitted forms and incorporate the FDF data to a PDF document that is passed then back to the user for download.

3. Annotations and comments.

Another typical usage example is commenting out certain sections of the document. FDF provides a client or a partner or a collaborator with a way to send to the author of the document digital comments without e-mailing, faxing or printing then scanning.

Here is how it looks: the author (let’s say, a designer) creates a PDF file and sends it to the client. The client then can review the document and leave his or her comments using FDF. Then, this FDF file is sent back to the author. It is small, easy to incorporate to the original PDF, and can contain a lot of information.

Using PDFium .NET library to work with FDF

PDFium is a high-performance .NET library. With it, you can easily implement PDF capabilities in yoiur own .NET applications. Along with functions to manipulate a PDF document, the library also allows you to work with FDF.

Here are the basic functions you need.


This function exports data from a form to the FDF document. Basically, this function takes a PDF document with a form, fetches all data from this form and exports them to the FDF file.


This function does the opposite: it imports the data from the specified FDF file to the PDF object.

Content property of FdfDocument class

This property holds FDF content as an ANSI string. Such a string can be easily processed in any way you need.

Together these three functions create a base for all manipulations with FDF required in the above scenarios. For instance, you can receive a PDF file from a user, use ExportToFdf to get the FDF data from it, then transform the data to editable content using Content property. After that you can send the data to the server, or process locally.

In many practical applications, though, you may also need the fourth:

PathToPdf property

This property of the FdfDocument class holds the path where the original PDF file containing the form is located.

Why should you bother? Because many PDF readers including Acrobat Reader rely on the path stored in an FDF file to locate the appropriate PDF form. Therefore, every time you manipulate with an FDF file, you should make sure it contains a correct path to the parent PDF document and that document does exist at that path.

Simply put, when exporting data to FDF with ExportToFdf make sure to specify the proper path to the source PDF as the first parameter as noted here. That’s all.

Add comment


Copyright © 2018 - Design by FS