Add Text and Images to a PDF 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.

In this tutorial, you’ll learn how to create an Automation Anywhere Task Bot that sends a PDF to PDF.co, adds text and images, and displays a download link for the edited document.

Prerequisites

Step 1: Access Control Room

Sign up for Automation Anywhere Community Edition. Follow the activation email to set your password and sign in to your Control Room.

Step 2: Create a Task Bot and Connect Your Computer

  1. Open Automation in the sidebar.
  2. Select Create → Task Bot.
  3. Name the bot PDF.co Add Text and Images.
  4. When prompted to connect your computer, download and install the Bot Agent. This prompt may appear when you first select Run.
  5. Complete the setup wizard, including enabling the browser extension and connecting your device.

Return to the bot editor once your computer is connected.

Step 3: Add the REST Web Services Action

In the Flow view, use Quick add between Start and End. Search for REST Web Services and select Post method.

Configure:

  • URI: https://api.pdf.co/v1/pdf/edit/add
  • Authentication mode: No Authentication
  • Content type: JSON (application/json)

PDF.co authenticates this request through the custom header configured next.

Step 4: Add Your PDF.co API Key

  1. Under Custom headers, select Add header.
  2. Enter x-api-key as the header name.
  3. To enter the key directly for this demo, switch the value type from Credential to Insecure string.
  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 use the Credential value type.

Step 5: Enter the Request Body

Under Custom parameters → Enter the parameters, paste:

{
  "name": "pdf-with-text-and-images.pdf",
  "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
  "async": false,
  "annotationsString": "20;20;0-;PDF updated with PDF.co API;24;Arial;FF0000;https://pdf.co;true",
  "imagesString": "100;180;0-;https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png|400;180;0-;https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png;https://pdf.co;200;200"
}

This request adds red text and two copies of the logo to every page:

  • url identifies the source PDF.
  • annotationsString specifies the text, position, font, size, color, and link.
  • imagesString specifies the image URLs and positions. The second image also includes a link and dimensions.
  • 0- targets every page, starting with page index 0.
  • | separates multiple image instructions.

Use PDF Inspector in your PDF.co account to determine placement coordinates for your own document. Refer to the PDF Add documentation for the supported parameters.

Step 6: Capture the Response

Under Assign the output to a variable:

  1. Select Multiple variables.
  2. Select Add variable mapping.
  3. Set Key to Body.
  4. Create a String variable named Body and map it to this key.
  5. Save the mapping.

Step 7: Display the Result

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 API response, including the output URL or an error message.

Step 8: Save and Run

Save the bot and select Run. Complete device connection if prompted.

For a successful request, the response includes error: false and a url. Open that URL to inspect the PDF and confirm that the text and logos appear in the expected positions.

Download the completed PDF before the temporary output link expires.

Related Tutorials

See Related Tutorials