New: PDF/A-3b conversion with a compliance report included.See Docs

Convert PDF to JSON 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 a Task Bot that sends a PDF to PDF.co and returns a link to its JSON representation, including extracted text and layout information.

Prerequisites

  • An Automation Anywhere Community Edition or Enterprise account.
  • A PDF.co account and API key.
  • A publicly accessible URL for a small sample PDF.

Set Up Automation Anywhere

Sign in to your Automation Anywhere Control Room. For a new Community Edition account, follow the activation instructions sent by email.

Install the Bot Agent when prompted, enable the browser extension, and complete the steps to connect your computer. The Bot Agent is required to run the bot locally.

Create a Task Bot

Go to Automation → Create → Task Bot and name it PDF to JSON.

In the Flow view, use Quick add between Start and End to add REST Web Services → Post method.

Configure the Request

Enter this URI:

https://api.pdf.co/v1/pdf/convert/to/json2

Set Authentication mode to No Authentication. PDF.co authentication is supplied through a custom header.

Under Custom headers, add:

  • Name: x-api-key
  • Value: Your PDF.co API key.

For this demo, select Insecure string to enter the key directly. For a production bot, store the key in Automation Anywhere’s Credential Vault and use the credential option.

Set Content type to JSON (application/json).

Enter the Request Body

Under Custom parameters → Enter the parameters, paste:

{
  "url": "https://example.com/sample.pdf",
  "name": "converted-document.json",
  "inline": false,
  "async": false
}

Replace the example URL with your PDF’s direct download URL.

With inline set to false, the response contains a download link to the JSON file. Omitting pages processes the entire PDF. See the PDF-to-JSON documentation for additional options.

Capture the Response

Under Assign the output to a variable:

  1. Select Multiple variables.
  2. Click 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.

Display the Result

Add a Message Box action after the REST Web Services action.

In Enter the message to display, insert the variable: $Body$

Run the Bot

Save and run the bot. Complete any remaining device-connection prompts.

The message box displays the API response. On success, it includes error: false and a url pointing to the generated JSON file.

Open the URL and download the file to inspect the extracted content. Save it before the temporary download link expires.

Now, you’ve learned how to convert PDF to JSON using Automation Anywhere and PDF.co plugin.

Related Tutorials

See Related Tutorials