Prompt
How do I OCR scanned PDFs with an API?
Latest observation
Oct 12, 2026
OpenAI APIWeb search: off
You can OCR scanned PDFs with an API by sending the PDF to an OCR service, then retrieving the extracted text or a searchable PDF output.
Common workflow
- Upload the PDF to the OCR API.
- Start an OCR job if the API is asynchronous.
- Poll for completion or receive a webhook callback.
- Download results:
- plain text
- JSON with layout/coordinates
- searchable PDF
- TSV/HOCR/ALTO, depending on the service
What to look for in an OCR API
- PDF support: scanned/image-only PDFs
- Language selection
- Page limits / file size limits
- Async processing for multi-page PDFs
- Confidence scores
- Layout extraction if you need tables/forms
- Searchable PDF output if you want to preserve the original document look
Example API flow
1) Upload and request OCR
curl -X POST https://api.example.com/ocr \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@scanned.pdf" \
-F "language=eng"
2) Check job status
curl https://api.example.com/ocr/jobs/JOB_ID \
-H "Authorization: Bearer YOUR_API_KEY"
3) Get result
curl https://api.example.com/ocr/jobs/JOB_ID/result \
-H "Authorization: Bearer YOUR_API_KEY"
If you want a searchable PDF
Some APIs return:
- the recognized text separately
- or a PDF with an invisible text layer added on top of the scanned images
That makes the PDF searchable and copyable.
Popular OCR API options
- Google Cloud Vision / Document AI
- AWS Textract
- Azure AI Vision / Document Intelligence
- OCR.space
- ABBYY
- Mindee
- Veryfi
Tips for better OCR
- Use 300 DPI scans when possible
- Prefer black text on white background
- Avoid skewed or rotated pages
- Split very large PDFs before sending if the API has limits
- Specify the correct language(s)
If you want to do it yourself
A typical open-source approach is:
- convert PDF pages to images
- run OCR with Tesseract
- optionally rebuild a searchable PDF
If you want, I can show you:
- a Python example using a real OCR API, or
- how to OCR PDFs locally with Tesseract.