How to Convert PDF Forms from XFA to Acroforms with cURL

Learn how to use pdfRest XFA to Acroforms API Tool to convert PDF forms with cURL
Share this page

Why Use XFA to Acroforms with cURL?

The pdfRest XFA to Acroforms API Tool allows users to convert XFA forms into Acroforms, making them more accessible and easier to handle. This tutorial will show you how to send an API call to the XFA to Acroforms endpoint using cURL, a command-line tool for transferring data with URLs.

Imagine you have a collection of XFA forms that need to be filled out by users who may not have the necessary software to handle XFA. By converting these forms to Acroforms, you make them more universally accessible, ensuring that users can fill them out using standard PDF readers. This conversion process can be automated using the pdfRest API and cURL.

XFA to Acroforms with cURL Code Example

curl -X POST "https://api.pdfrest.com/pdf-with-acroforms" \
  -H "Accept: application/json" \
  -H "Content-Type: multipart/form-data" \
  -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
  -F "file=@/path/to/file"

Source: pdf-with-acroforms.sh

Breaking Down the Code

Let's break down the provided code to understand how each part works:

curl -X POST "https://api.pdfrest.com/pdf-with-acroforms"

This line initiates a POST request to the pdfRest API endpoint for converting XFA forms to Acroforms.

-H "Accept: application/json"

This header tells the server that the client expects the response to be in JSON format.

-H "Content-Type: multipart/form-data"

This header specifies that the content type of the request is multipart/form-data, which is necessary for file uploads.

-H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

This header includes the API key required for authentication. Replace xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx with your actual API key.

-F "file=@/path/to/file"

This line specifies the file to be uploaded. Replace /path/to/file with the actual path to your XFA form file.

Beyond the Tutorial

In this tutorial, we demonstrated how to use cURL to call the pdfRest XFA to Acroforms API endpoint. This process involves setting the appropriate headers and specifying the file to be converted.

We encourage you to explore all of the pdfRest API Tools in the API Lab. For more detailed information, refer to the API Reference Guide.

Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at pdf-with-acroforms.sh.

Generate a self-service API Key now!

Create your FREE API Key to start processing PDFs in seconds, only possible with pdfRest.

Compare Plans
Contact Us