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

How to Convert PDF to Text Using Automation Anywhere and PDF.co

Build a Task Bot that sends a PDF to PDF.co and returns a link to the extracted text file. This workflow uses Automation Anywhere’s REST Web Services action and does not require a PDF.co plugin.

Prerequisites

  • An Automation Anywhere Community Edition or Enterprise account.
  • A PDF.co account and API key.
  • A computer that meets Automation Anywhere’s Bot Agent requirements.

Sign In to Control Room

Register for Automation Anywhere or use your existing account. For a new Community Edition account, follow the activation email to set your password and open your Control Room.

Install and Connect the Bot Agent

Before running your bot, install the local Bot Agent.

  1. Follow the Control Room prompts to download and install the Bot Agent.
  2. Enable the browser extension when prompted.
  3. Complete the Connect your computer and device information steps.

If the installation prompt appears when you first click Run, complete these steps before continuing.

Create a Task Bot

Go to Automation → Create → Task Bot.

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

Configure the Request

In Enter the URI, enter: https://api.pdf.co/v1/pdf/convert/to/text

Set Authentication mode to No Authentication. PDF.co authenticates this request through a custom header.

Under Custom headers, click Add header:

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

For a quick test, select Insecure string as the value type to enter the key directly. For a reusable or shared bot, store the key in Automation Anywhere’s Credential Vault and select the stored credential.

Set Content type to JSON (application/json).

Add the Request Body

Under Custom parameters → Enter the parameters, paste:

{
  "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-to-text/sample.pdf",
  "name": "result.txt",
  "inline": false,
  "async": false
}

The url identifies the source PDF, and name sets the output filename. With inline set to false, PDF.co returns a download link to the text file.

You can replace the sample URL with a direct PDF URL accessible to PDF.co. See the PDF-to-text 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 select it as the destination.
  5. Click Add.

This stores the full API response as text.

Display the Result

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

In Enter the message to display, enter: $Body$

Save and Run

Click Save, then Run. Complete any remaining device connection prompts.

The message box displays PDF.co’s JSON response. A successful response contains error: false and a url for the generated text file. Open that URL to view or download the text before the temporary link expires.

Optional: Return Text Directly

To include the extracted text in the API response, change the request body’s inline setting to true.

The extracted text will appear in the response’s lowercase body property. Your Automation Anywhere Body variable will still contain the complete JSON response.

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

Related Tutorials

See Related Tutorials