OCR a PDF in Linux

This guide provides an overview of the OCR API and how to use it. For information on what OCR can do, please see the OCR Overview guide.

Before you get started, make sure that Processor is up and running.

Running OCR on All Pages

To run OCR on all pages of a document, send a performOcr operation, along with an input file or a URL, to Processor’s /process endpoint:

curl -X POST http://localhost:5000/process \
  -F url=https://pspdfkit.com/downloads/examples/scanned.pdf \
  -F operations='{
  "operations": [
    {
      "type": "performOcr",
      "pageIndexes": [
        0
      ],
      "language": "english"
    }
  ]
}' \
  -o result.pdf
POST /process HTTP/1.1
Content-Type: multipart/form-data; boundary=customboundary

--customboundary
Content-Disposition: form-data; name="url"

https://pspdfkit.com/downloads/examples/scanned.pdf
--customboundary
Content-Disposition: form-data; name="operations"
Content-Type: application/json

{
  "operations": [
    {
      "type": "performOcr",
      "pageIndexes": [
        0
      ],
      "language": "english"
    }
  ]
}
--customboundary--