Skip to Content
NexPDF

OCR

Make scanned documents searchable and selectable.

English

POST /v1/ocr recognises the text on scanned pages and adds it as an invisible layer, so the PDF looks the same but can be searched, selected and copied.

Name the languages with their three-letter Tesseract codes, joined with + (such as eng+por); leaving them out uses English.

Cost: 1 unit per page.

Make a scan searchable

curl https://api.nexpdf.dev/v1/ocr \
  -H "Authorization: Bearer $NEXPDF_API_KEY" \
  -F document=@scan.pdf \
  -F languages=eng+por \
  -o searchable.pdf

OCR as part of a pipeline

In a build, ocr is an action, so later actions (redaction, extraction) see the recognised text.

curl https://api.nexpdf.dev/v1/build \
  -H "Authorization: Bearer $NEXPDF_API_KEY" \
  -F scan=@scan.pdf \
  -F 'instructions={
    "parts": [
      {
        "file": "scan"
      }
    ],
    "actions": [
      {
        "type": "ocr",
        "languages": "eng"
      },
      {
        "type": "redact",
        "query": "email",
        "mode": "pattern"
      }
    ],
    "output": {
      "type": "pdf"
    }
  }' \
  -o searchable.pdf

On this page