How to convert scanned PDF to text with Nutrient's OCR API
Table of contents
- Convert scanned PDFs to searchable text using Nutrient’s OCR API
- Single API call with curl — no SDK installation required
- Supports 80+ languages including Chinese, Japanese, Arabic, and European languages
Use Nutrient API to convert a scanned PDF into a searchable document using optical character recognition (OCR).
Why use OCR?
Scanned documents are essentially images — you can’t select, search, or copy text from them. OCR extracts the text and embeds it into the PDF, making it:
- Searchable — Find specific content instantly with Control-F
- Selectable — Copy and paste text into other applications
- Accessible — Screen readers can read the document aloud
- Indexable — Search engines and document management systems can catalog the content
Common use cases include:
- Legal document archival — Digitize contracts, court filings, and case files for easy retrieval
- Invoice processing — Extract text from scanned invoices for accounting systems
- Healthcare records — Convert paper medical records to searchable digital format
- Historical document preservation — Make old manuscripts and archives text-searchable
Getting started
You’ll need a sample PDF containing scanned images. Use this sample document if needed — the text isn’t selectable or searchable until OCR is applied.
Step 1 — Create a free account
Prerequisites: You’ll need curl installed and a Nutrient API key (free tier includes 50 credits).
Create a Nutrient API account. The free plan includes 50 credits; different operations consume varying amounts.
Copy your API key from the dashboard.
Step 2 — Make a request
Make a request to the /build endpoint with your API key and document:
curl -X POST https://api.nutrient.io/build \ -H "Authorization: Bearer <YOUR-API-KEY>" \ -o result.pdf \ --fail \ -F scanned=@document.pdf \ -F instructions='{ "parts": [ { "file": "scanned" } ], "actions": [ { "type": "ocr", "language": "english" } ] }'The result.pdf file now has searchable, selectable text.
Supported languages
Nutrient’s OCR API supports 80+ languages, including:
| Category | Languages |
|---|---|
| European | English, French, German, Spanish, Italian, Portuguese, Dutch, Polish, Swedish, Norwegian, Danish, Finnish |
| Asian | Chinese (Simplified/Traditional), Japanese, Korean, Vietnamese, Thai, Indonesian, Malay |
| Middle Eastern | Arabic, Hebrew, Persian, Turkish |
| Indic | Hindi, Bengali, Tamil, Telugu, Gujarati, Punjabi |
| Other | Russian, Ukrainian, Greek, Latin, and many more |
You can specify the language using either the full name (english) or ISO 639-2 code (eng). For documents with multiple languages, pass an array:
"language": ["english", "french"]See the complete language support documentation for the full list.
Tips for better OCR accuracy
Follow these best practices to maximize recognition quality:
Image quality
- Resolution — Aim for 200–300 DPI. Higher isn’t always better; resolutions above 300 DPI can degrade accuracy for larger fonts
- Font size — Optimal range is 10–30 pt. Fonts larger than 30 px may be skipped or misinterpreted
- Clarity — Use clean, high-contrast scans. Avoid noise, skewing, and heavy compression
Let the API handle preprocessing
Avoid manually preprocessing images before OCR. Nutrient’s OCR engine applies automatic preprocessing that typically yields better results than manual adjustments like deskewing or contrast enhancement.
Choose the right language
Specifying the correct language improves accuracy significantly. For multilingual documents, specify all relevant languages — the engine will detect which applies to each text region.
Combine OCR with other operations
The Nutrient API can chain multiple operations in a single request. After OCR, you can:
- Merge documents — Combine multiple scanned files into one searchable PDF
- Add watermarks — Stamp “CONFIDENTIAL” or company branding
- Flatten annotations — Burn in form fields or comments
- Compress — Reduce file size for archival
Example combining OCR with watermarking:
curl -X POST https://api.nutrient.io/build \ -H "Authorization: Bearer <YOUR-API-KEY>" \ -o result.pdf \ --fail \ -F scanned=@document.pdf \ -F instructions='{ "parts": [ { "file": "scanned" } ], "actions": [ { "type": "ocr", "language": "english" }, { "type": "watermark", "text": "CONFIDENTIAL" } ] }'Summary
Nutrient’s OCR API transforms scanned documents into searchable, accessible PDFs with a single API call. Key capabilities:
- 80+ languages — From English to Chinese to Arabic
- No preprocessing required — The engine handles image optimization automatically
- Chainable operations — Combine OCR with watermarks, merges, and compression
- Simple integration — Works with curl, any HTTP client, or Nutrient SDKs
Next steps
- View the complete OCR API documentation
- Explore language support options
- Learn about OCR best practices
- Try Nutrient Web SDK for client-side OCR
- Check out Document Engine for server-side processing
FAQ
OCR (optical character recognition) analyzes images of text and converts them into machine-readable characters. The Nutrient OCR API scans your PDF, identifies text regions, recognizes characters, and embeds an invisible text layer that makes the document searchable and selectable.
Nutrient’s OCR API supports over 80 languages, including English, Chinese (Simplified and Traditional), Japanese, Korean, Arabic, Hebrew, Hindi, and all major European languages. You can specify multiple languages for multilingual documents.
No. Nutrient’s OCR engine includes automatic preprocessing that typically produces better results than manual adjustments. Avoid deskewing or contrast enhancement before sending documents to the API.
Aim for 200–300 DPI. Resolutions above 300 DPI can actually degrade accuracy for larger fonts. Ensure scans are clean with good contrast and minimal noise.
Yes. The Nutrient API supports chaining multiple operations in a single request. You can apply OCR and then add watermarks, merge documents, flatten annotations, or compress the file — all in one API call.