
Automate Factur-X and ZUGFeRD e-Invoices in Python with PDF.co
15 MIN READ
5 MIN READ
Automation Anywhere is a technology company headquartered in San Jose, California, USA. It is a provider of an end-to-end Robotic Process Automation (RPA) and Artificial Intelligence (AI) platform for automating any business process. They offer Discovery Bot for fast-track automation, IQ Bot for transforming unstructured and hidden data with AI that can learn on its own, Bot Insight for real-time analytics, and a Bot Store to get pre-built automation solutions.
This tutorial shows how to create an Automation Anywhere Task Bot that sends form data to PDF.co and returns a filled PDF. The bot uses the PDF.co PDF Add API through Automation Anywhere’s REST Web Services action.
Register for Automation Anywhere and follow the activation instructions sent to your email.
Use the supplied Control Room URL to set your password and sign in.
The Bot Agent connects your local device to the Automation Anywhere Control Room and is required to run the bot.
From the Control Room:
See the Automation Anywhere Bot Agent documentation for installation requirements.
In the Control Room:
PDF.co Fill Form.A Task Bot provides the step-by-step action editor needed for this workflow.
In the bot’s Flow view:
Enter the following URI:
https://api.pdf.co/v1/pdf/edit/add
Leave the Authentication setting as No Authentication. The PDF.co API key will be supplied through a custom request header.
Set the content type to:
JSON (application/json)
Under Custom headers, add a header with these values:
x-api-keyInsecure stringThe value field may initially use Credential mode. Change it to Insecure string before entering the API key directly.
Under Custom parameters, enter the following JSON:
{
"name": "f1040-form-filled",
"url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
"fieldsString": "1;topmostSubform[0].Page1[0].f1_02[0];John A. Doe|1;topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1];true|1;topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0];123456789"
}The fieldsString property uses this structure:
page;fieldName;value
Separate multiple fields with a pipe character:
page;fieldName;value|page;fieldName;value
Page numbering starts at 0. The sample uses page 1 because the PDF contains a cover page before the form.
Replace the sample field names and values when using your own PDF template. You can use the PDF.co PDF Inspector to inspect the template and identify its form field names.
Under Assign the output to a variable:
Body as the key.Body.The variable will contain the JSON response returned by PDF.co.
Add a Message Box action after the REST Web Services action.
In the message field, enter:
$Body$
This displays the complete PDF.co response when the bot finishes.
Save the Task Bot and click Run. Select the registered device if prompted.
After a successful request, the message box displays a JSON response containing the URL of the filled PDF. Open that URL to review the result.
PDF.co output URLs are temporary. Download the file or send it to permanent storage if it must be retained.
You have created an Automation Anywhere Task Bot that sends form values to the PDF.co PDF Add API, fills the corresponding fields, and returns a downloadable PDF.
Create an account, get an API key and test a request.