Merge PDFs Using Automation Anywhere and PDF.co
About Automation Anywhere
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 is a step by step tutorial on how to create an Automation Anywhere Task Bot that combines two PDF files and displays a download link for the merged document.
Prerequisites
- An Automation Anywhere Community Edition account
- A PDF.co account and API key
- A computer on which you can install the Automation Anywhere Bot Agent
Sign In to Control Room
Complete the Community Edition signup. Follow the activation email to access your Control Room, set your password, and sign in.
Create a Task Bot
- Open Automation in the sidebar.
- Select Create → Task Bot.
- Name the bot
PDF.co Merge PDFs.
Install and Connect the Bot Agent
Before the bot can run, your computer must be connected to Control Room.
- When prompted to connect your computer, download and install the Bot Agent. This prompt may appear when you first select Run.
- Follow the setup wizard to enable the browser extension.
- Complete Connect your computer and Device information.
- Return to the bot editor.
Add the REST Web Services Action
In the Flow view, select Quick add between Start and End. Search for REST Web Services and choose Post method.
Configure:
- URI:
https://api.pdf.co/v1/pdf/merge - Authentication mode: No Authentication
- Content type: JSON (
application/json)
PDF.co authenticates the request through the custom header added next.
Configure the API Key Header
- Under Custom headers, select Add header.
- Set Name to
x-api-key. - Switch the value type to Insecure string to enter the key directly for this demo.
- Paste your PDF.co API key.
- Select Add.
For a reusable bot, you can store the key in Automation Anywhere’s Credential Vault and select it using the Credential value type.
Enter the Merge Request
Under Custom parameters → Enter the parameters, paste:
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-merge/sample1.pdf,https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-merge/sample2.pdf",
"name": "merged-document.pdf",
"async": false
}The url value contains the source PDF URLs separated by commas, in the order they should appear in the merged document. Replace these sample URLs with accessible links to your own PDFs when ready.
The name sets the output filename. Using async: false lets this small example return the result directly. See the PDF Merge documentation for additional options.
Capture the Response
Under Assign the output to a variable:
- Select Multiple variables.
- Select Add variable mapping.
- Enter
Bodyas the key. - Create a String variable named
Bodyand map it to that key. - Select Add.
Add a Message Box
Add a Message Box action after the REST Web Services action.
In Enter the message to display, enter:
$Body$
The message box will display the complete API response.
Save, Run, and Review
- Save the bot.
- Select Run.
- Complete device connection if prompted.
- Check the displayed response for
error: falseand an outputurl. - Open that URL and verify that the PDFs were merged in the expected order.
Download the merged PDF before the temporary output link expires.
Related Tutorials
