OCR and documents
Convert Office files, ebooks and PDFs to Markdown, and read text out of scanned pages.
Webfold converts documents through the Superdocuments library. Plain formats convert directly. A PDF page with no text layer falls back to optical character recognition.
Formats
| Format | Route |
|---|---|
| DOCX, DOCM | Markdown through convert |
| PPTX | Text per slide |
| XLSX, XLSM, XLSB | One section per sheet; structured sheet reads are available in the library |
| ODT, ODP, ODS | Markdown through convert |
| EPUB | Markdown, or spine-ordered text and a book structure in the library |
| RTF, CSV, HTML, text | Markdown |
| Legacy XLS | Through Webfold’s own adapter (webfold convert), not the library alone |
| Text extraction to Markdown, with an optional OCR fallback |
webfold convert report.docx
webfold pdf report.pdf
webfold pdf scan.pdf --chunk 4000
webfold chunk notes.docx --size 3000 --jsonl
How OCR works
- The PDF parser reads each page’s own text layer.
- A page with no text, or a scan whose only text is a stamp, is rendered to an image with Poppler’s
pdftoppm. Other pages keep their own text. - Tesseract recognises the text and it is returned as Markdown with the rest of the document.
In library code:
let markdown = superdocuments::pdf::extract_file("scan.pdf")?;
Structure, not just text
The library also exposes structured output: xlsx::read_workbook and read_sheet, epub::read, pdf::outline, JSON page output and a DocumentGraph of regions with provenance.
What to expect
See the document benchmark for speed figures and their limits.
Hosted API
curl -s https://api.webfold.ai/v1/ocr \
-H "Authorization: Bearer $WEBFOLD_API_KEY" -H "Content-Type: application/json" \
-d '{"content_base64":"<base64 of scan.pdf>","languages":"eng","max_pages":20}'
POST /v1/ocr reads the PDF’s own text first ("method": "text") and falls back to Tesseract for pages without one ("method": "ocr"). The file is sent in the request, up to 25 MiB. languages takes Tesseract codes such as eng+deu, max_pages is 1 to 200, and timeout_secs is 1 to 300. A server runs a few OCR jobs at once, so a busy one answers 503; retry shortly. POST /v1/documents/convert does the same for Word, Excel, PowerPoint, OpenDocument, EPUB, RTF, CSV and HTML. See the API reference.