Last updated: September 7, 2024

<span aria-hidden="true" id="introducing-text-extraction-from-pdfs-with-ai-robot"></span>

# Introducing text extraction from PDFs with AI Robot

![Joseph Grabski](/assets/images/teammates/joseph2.png?dpl=dpl_3fBRD5jmFtSDABLXGJJyXU1nVXf8)

**Joseph Grabski**

Content Lead · Rochester, United Kingdom · Show bio

[](https://x.com/joe%5Fgrabski)[](https://github.com/Missing-Tech)

For a while now, we've offered AI-powered Robots that go beyond the normal capabilities of our Robots. For example, many of you may be familiar with our industrious[/image/facedetect](/docs/robots/image-facedetect.md) Robot that automatically recognizes faces within an image. It is perfect for identifying a face in an image and then cropping it for a user's profile picture.

Today, we are excited to introduce a new addition to our AI Robots family: the[/document/ocr](/docs/robots/document-ocr.md) Robot.

The keen-eyed amongst you may have noticed that we already offer the[/image/ocr](/docs/robots/image-ocr.md) Robot, which performs a similar, but recognizably different role within our arsenal.

If we take a peek under the hood, the [/document/ocr](/docs/robots/document-ocr.md) Robot is powered by [AWS Textract⁠](https://aws.amazon.com/textract/) and[GCP Document AI⁠](https://cloud.google.com/document-ai/). This means it is explicitly trained to deal with long-form documents and large chunks of text – the type of text that you might find in a novel or scientific paper. Moreover, it works brilliantly at extracting text from tables and forms, meaning it's well-equipped to handle invoices too for example.

Comparatively, the [/image/ocr](/docs/robots/image-ocr.md) Robot uses[Amazon Rekognition⁠](https://docs.aws.amazon.com/rekognition/latest/dg/text-detection.html) and[GCP's Vision API⁠](https://cloud.google.com/vision/docs/ocr/), which are both trained on small pieces of text – for example in stop signs, package labels and name tags.

Perhaps the most key difference, though, is that the[/document/ocr](/docs/robots/document-ocr.md) Robot has support for *PDFs*, making it ideal for handling important documents from your clients.

<span aria-hidden="true" id="extracting-text"></span>

## Extracting text

As always, the best way to learn about these differences is not for me to tell you about them, but instead for me to *show* them to you. So, let's analyze the difference in output from the[/document/ocr](/docs/robots/document-ocr.md) Robot compared to the[/image/ocr](/docs/robots/image-ocr.md) Robot.

Here's the first Template, using the [/image/ocr](/docs/robots/image-ocr.md) Robot.

```json
{
  "steps": {
    ":original": {
      "robot": "/upload/handle"
    },
    "detect": {
      "robot": "/image/ocr",
      "use": ":original",
      "provider": "aws",
      "format": "meta",
      "granularity": "full"
    },
    "exported": {
      "use": "detect",
      "robot": "/s3/store",
      "credentials": "my_s3_credentials"
    }
  }
}

```

And then the second Template, which uses the[/document/ocr](/docs/robots/document-ocr.md) Robot.

```json
{
  "steps": {
    ":original": {
      "robot": "/upload/handle"
    },
    "detect": {
      "robot": "/document/ocr",
      "use": ":original",
      "provider": "aws",
      "format": "meta",
      "granularity": "full"
    },
    "exported": {
      "use": "detect",
      "robot": "/s3/store",
      "credentials": "my_s3_credentials"
    }
  }
}

```

The below images showcase the bounding boxes from both Templates overlayed on top of an example invoice, using [/image/ocr](/docs/robots/image-ocr.md) on the left and[/document/ocr](/docs/robots/document-ocr.md) on the right.

/image/ocr - Template 1

![An example invoice with bounding boxes around the recognized text, using AWS Rekognition](/_next/static/immutable/media/2023-11-rekognition-output.2rq6-ta2n16q2.png)

/document/ocr - Template 2

![An example invoice with bounding boxes around the recognized text, using AWS Textract](/_next/static/immutable/media/2023-11-textract-output.2_q4wptrb_umd.png)

As demonstrated, the [/document/ocr](/docs/robots/document-ocr.md) Robot does a much better job at recognizing the relevant information in the document – especially when it comes to the table and subsequent text, where the [/image/ocr](/docs/robots/image-ocr.md) Robotseems to struggle a little more.

For those that are curious as to how we obtained the bounding boxes from both Robots, we used a `granularity` value of `full` to include the bounding boxes for the recognized text as part of the output. If you are only interested in the recognized text, change this value to `list`.

That's all it takes to start recognizing text in documents or images! There's no need for trawling through SDK documentation, or wrestling with an API – it is as simple as that.

<span aria-hidden="true" id="until-next-time"></span>

## Until next time!

That's all we have to show off for now. Be sure to[reach out to us](mailto:support@transloadit.com)if you have a compelling new idea for a Robot, as we are always looking for new ways to innovate 💡

[#assembly](/blog/tags/assembly.md)[#document-ocr-robot](/blog/tags/document-ocr-robot.md)[#image-ocr-robot](/blog/tags/image-ocr-robot.md)[#image-facedetect-robot](/blog/tags/image-facedetect-robot.md)[#walkthrough](/blog/tags/walkthrough.md)

### 👩‍💻 Join 20k+ developers

Sign up for our [monthly newsletter](/newsletters.md) to receive direct links to 3 exclusive tech — and 2 product updates. No less, no more.

Your email:

Get access

## File uploading and encoding. Made simple.

Transloadit streamlines file handling for developers, trusted by brands like Coursera and The New York Times. We’re known for a reliable API, top-notch support, and a strong commitment to open source, with projects like [Uppy⁠](https://uppy.io) and [Tus⁠](https://tus.io) setting standards in file processing.

[Sign up](/c/)[Book a Demo](https://survey.typeform.com/to/kRg47Xi5)

No credit card needed · 5 GB included in the free plan

Cancel anytime
