PDF OCR API

Extract text from images and transform scanned documents into interactive, searchable PDFs with a reliable OCR API built for seamless integration.

Why Nutrient DWS API?

SOC 2 Compliant

Build the workflows you need without worrying about security. We don’t store any document data, and our API endpoints are served through encrypted connections.

Easy Integration

Get up and running in hours, not weeks. Access well-documented APIs and code samples that make integrating with your existing workflows a snap.

Robust and Flexible

With access to more than 30 tools, you can process one document in multiple ways by using API credits. Generate PDF from HTML, convert Word, Excel, PowerPoint and image files to PDF, and more.

Simple and Transparent Pricing

Select a package that suits your needs according to the number of credits you wish to spend. Each API tool and action has a specific credit cost.

Try It Out

This example will run English language OCR on your uploaded document, making any text in the document selectable and searchable.

1

Use Your Free API Calls

Sign up and receive 100 credits for free, or log in to automatically add your API key to sample code. If you are not sure how credits are consumed read more in our pricing documentation , or check out this guide on calculating credit usage.

2

Add a File

Add a scanned PDF named document.pdf to your project folder. You can also use our sample file. The file name is case sensitive. Make sure the file name matches the file name in the sample code.

3

Run the Code

Copy the code and run it from the same folder you added the files to. For more information, see our language-specific getting started guides.

4

View the Results

Open result.pdf in your project folder to view the results.

curl -X POST https://api.nutrient.io/build \
  -H "Authorization: Bearer your_api_key_here" \
  -o result.pdf \
  --fail \
  -F scanned=@document.pdf \
  -F instructions='{
      "parts": [
        {
          "file": "scanned"
        }
      ],
      "actions": [
        {
          "type": "ocr",
          "language": "english"
        }
      ]
    }'
Using Postman? Download our official collection and start using the API with a single click. Read more 

Your API Key

Getting Started

The following section will walk you through how to best make use of all the functionality the OCR API provides.

The Basics of OCR

Let’s start with the basics. The OCR API allows you to take files in any supported format and make any text in them selectable and searchable. This is useful for images and scanned documents. To learn more about OCR itself, see here.

For our first example, we’ll run OCR on a single image file. To do this, add a page1.jpg file to the same folder as your code. You can use any image containing text, or use our provided sample page.

Run the code, and you’ll get a result.pdf with your page OCRed. Our example sets the OCR language to English. If your content is in a different language, make sure to update the language property accordingly. You can find a list of all supported languages at the bottom of this page.

Code to perform OCR:

curl -X POST https://api.nutrient.io/build \
  -H "Authorization: Bearer your_api_key_here" \
  -o result.pdf \
  --fail \
  -F page1.jpg=@/path/to/page1.jpg \
  -F instructions='{
      "parts": [
        {
          "file": "page1.jpg"
        }
      ],
      "actions": [
        {
          "type": "ocr",
          "language": "english"
        }
      ]
    }'

Advanced OCR

While running OCR on a single page is useful, often you’ll have a folder full of scanned pages that you want to both run OCR on and merge into a single searchable PDF.

Luckily, this is easy; pass in multiple images — one for each page in your request — and Nutrient DWS API will merge all of them into a PDF before running OCR on it.

Add more files in the same folder as your code and run the updated code. You can duplicate and rename the existing file you have, or you can add some other images containing text.

Code to perform OCR on multiple pages:

curl -X POST https://api.nutrient.io/build \
  -H "Authorization: Bearer your_api_key_here" \
  -o result.pdf \
  --fail \
  -F page1.jpg=@/path/to/page1.jpg \
  -F page2.jpg=@/path/to/page2.jpg \
  -F page3.jpg=@/path/to/page3.jpg \
  -F page4.jpg=@/path/to/page4.jpg \
  -F instructions='{
      "parts": [
        {
          "file": "page1.jpg"
        },
        {
          "file": "page2.jpg"
        },
        {
          "file": "page3.jpg"
        },
        {
          "file": "page4.jpg"
        }
      ],
      "actions": [
        {
          "type": "ocr",
          "language": "english"
        }
      ]
    }'

Supported Languages

Finally, here’s a listing of all supported languages:

Croatian

Czech

Danish

Dutch

English

Finnish

French

German

Indonesian

Italian

Malay

Norwegian

Polish

Portuguese

Serbian

Slovak

Slovenian

Spanish

Swedish

Turkish