How to Extract Text from a Scanned PDF Using Postman and PDF.co

This tutorial shows you how to use PDF.co’s OCR-enabled PDF-to-Text API to extract text from a scanned PDF in Postman.

What You’ll Need

  • A PDF.co account and API key
  • The Postman desktop application
  • A scanned PDF available through a direct URL or PDF.co File Storage link

Step 1: Create the Postman Request

Open Postman and create a new HTTP request.

Configure it as follows:

  • Method: POST
  • URL: https://api.pdf.co/v1/pdf/convert/to/text

Step 2: Add the Request Headers

Add these headers:

  • x-api-key: Your PDF.co API key
  • Content-Type: application/json

Step 3: Configure the Request Body

Open the Body tab, select raw, and choose JSON.

Enter the following request:

{
  "url": "https://example.com/scanned-document.pdf",
  "pages": "0-",
  "lang": "eng",
  "inline": true,
  "async": false,
  "profiles": "{ 'OCRMode': 'TextFromImagesOnly', 'OCRResolution': 300 }"
}

Replace the example URL with a direct link to your scanned PDF. The URL must be accessible to PDF.co. You can also use a filetoken:// link from PDF.co File Storage.

The request uses these settings:

  • pages: 0- processes every page.
  • lang: eng selects English for OCR. Change it when processing another language.
  • inline: true returns the extracted text directly in the response.
  • async: false waits for the conversion to finish before returning the result.
  • OCRMode: TextFromImagesOnly extracts text from page images.
  • OCRResolution: 300 uses the default 300 DPI OCR resolution.

PDF.co also supports Auto OCR mode for documents that may contain a mixture of scanned images and existing text. Review the PDF-to-Text documentation and Profiles documentation for the current OCR modes, preprocessing filters, resolution settings, rotation options, and other extraction parameters.

Step 4: Send the Request

Select Send in Postman.

A successful response resembles:

{
  "body": "Extracted text from the scanned PDF...",
  "pageCount": 1,
  "error": false,
  "status": 200,
  "name": "scanned-document.txt",
  "remainingCredits": 1000
}

Confirm that:

  • error is false.
  • status is 200.
  • body contains the extracted text.
  • pageCount matches the number of processed pages.

Step 5: Download the Result as a Text File

To receive a downloadable text file, change:

"inline": false

Send the request again. The response will contain a temporary URL to the generated text file:

{
  "url": "https://pdf-temp-files.s3.amazonaws.com/.../scanned-document.txt",
  "error": false,
  "status": 200
}

Open the URL to download the file. Save it to permanent storage if it must remain available because PDF.co output links are temporary.

Conclusion

You have extracted text from a scanned PDF using Postman and PDF.co’s OCR-enabled PDF-to-Text endpoint. You can adjust the language, OCR mode, resolution, page range, and preprocessing options for different document types by using the parameters listed in the PDF.co documentation.

Related Tutorials

See Related Tutorials