Convert PDF to FDF file using Java

PDF form is a special kind of PDF document that contains interactive fields where textual information can be entered or check boxes may be selected. This format of document is widely used to collect data over the internet. After data collection, one of the viable options to preserve the data is to convert PDF to FDF format. An FDF (Forms Data Format) file is a text document that is generated by exporting data from the form fields of a PDF file. It includes only text fields data that is extracted from the form fields available in a PDF file. Furthermore, an FDF file containing form data for a PDF form is much smaller than the file containing the PDF form itself, so archiving FDF files requires less storage space than archiving PDF forms. Now in this article, we are going to discuss the details for converting PDF to FDF file without Adobe Acrobat.

PDF Conversion API

One of our reliable solutions offering the capabilities to create, edit and manipulate PDF documents is Aspose.PDF Cloud. It also enables you to load PDF file and convert to an array of supported formats. Similarly, it is equally capable of loading PDF forms and enables us to extract form data into FDF format. Now we are going to add the reference of Aspose.PDF Cloud SDK for Java in our Java application by including following details in pom.xml (maven build type project).



The next important step is to obtain your client credentials from Cloud Dashboard. In case you are not already registered, please register using valid email address and fetch your personalized credentials.

PDF to FDF in Java

We are now going to learn the steps on how to load PDF document from cloud storage and convert to FDF file.

  • Create an object of PdfApi while passing personalized credentials as arguments
  • Secondly, read the content of PDF document using File instance and upload to cloud storage using uploadFile(…) method of PDfAPi
  • Now simply call the method putExportFieldsFromPdfToFdfInStorage(…) to convert PDF to FDF file. The resultant file is stored in cloud storage

Image:- PDF to FDF conversion preview

You may consider downloading the input PDF form from PdfWithAcroForm.pdf.

Export PDF to Adobe FDF using cURL Commands

Another option for accessing the REST APIs is via cURL commands. So we are going to export PDF Form data to FDF file using the cURL commands. Now the pre-requisites is to generate a JWT access token (based on client credentials) using following command.

curl -v "https://api.aspose.cloud/connect/token" \
-d "grant_type=client_credentials&client_id=bb959721-5780-4be6-be35-ff5c3a6aa4a2&client_secret=4d84d5f6584160cbd91dba1fe145db14" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Once the JWT is generated, we need to execute the following command to load input PDF from Cloud storage and export to FDF format. Furthermore, instead of saving the output Adobe FDF to cloud storage, we are going to save it on local drive.

curl -v -X GET "https://api.aspose.cloud/v3.0/pdf/input.pdf/export/fdf" \
-H  "accept: multipart/form-data" \
-H  "authorization: Bearer <JWT Token>" \
-o "Exported.fdf"


In this guide, we have shown the steps to use Java REST API to convert PDF forms to FDF (Forms Data Format). The complete process has been simple and straightforward, and can be easily integrated into your existing Java application. Whether you need to convert a single PDF form or batch process multiple forms, our guide makes it easy to convert PDF to FDF and export PDF form data to FDF format.

We also recommend exploring the Product Documentation which is an amazing source of information to learn about other exciting features. In case you need to download and modify the source code of Cloud SDK, it is available on GitHub (published under MIT license). Lastly, in case you encounter any issues while using the API, you may consider approaching us for a quick resolution via free product support forum.

Please visit the following links to learn more about: