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

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

  1. Open Automation in the sidebar.
  2. Select Create → Task Bot.
  3. 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.

  1. When prompted to connect your computer, download and install the Bot Agent. This prompt may appear when you first select Run.
  2. Follow the setup wizard to enable the browser extension.
  3. Complete Connect your computer and Device information.
  4. 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

  1. Under Custom headers, select Add header.
  2. Set Name to x-api-key.
  3. Switch the value type to Insecure string to enter the key directly for this demo.
  4. Paste your PDF.co API key.
  5. 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:

  1. Select Multiple variables.
  2. Select Add variable mapping.
  3. Enter Body as the key.
  4. Create a String variable named Body and map it to that key.
  5. 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

  1. Save the bot.
  2. Select Run.
  3. Complete device connection if prompted.
  4. Check the displayed response for error: false and an output url.
  5. 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

See Related Tutorials