Infery.ai
← All tools

Extract text from document

Document

document.extract_text

in: documentout: text

Parse PDF/DOCX/HTML/etc. to markdown or JSON, with optional OCR.

Pricing

Price
1.25 cr / request

Prices in credits (1 credit = $0.01).

Extract Text from Document

Parse PDF, DOCX, HTML, and other document formats into structured markdown or JSON, with optional OCR for scanned pages.

When to use

  • Extract content from PDFs (reports, contracts, invoices) for downstream text processing.
  • OCR scanned documents — force OCR on image-only PDFs where no selectable text layer exists.
  • Normalize to markdown for ingestion into RAG pipelines or LLM context windows.

Inputs & outputs

Input modalityDocument file (URL)
Output modalityText (markdown or JSON)
Supported formatsPDF, DOCX, XLSX, PPTX, HTML, EPUB, ODT
Max input size100 MB

Parameters

ParamRequiredDescription
ocrnoOCR mode — auto (try text layer first), force (always OCR), off (text layer only). Default: auto
output_formatnoOutput format — markdown or json. Default: markdown

Examples

PDF with auto-OCR → markdown

{
  "type": "document.extract_text",
  "input": { "document_url": "gs://infery-prod-media/docs/report.pdf" },
  "params": { "ocr": "auto", "output_format": "markdown" }
}

Force OCR on scanned invoice → JSON

{
  "type": "document.extract_text",
  "input": { "document_url": "gs://infery-prod-media/docs/scanned_invoice.pdf" },
  "params": { "ocr": "force", "output_format": "json" }
}

Pricing

Billed per page processed. OCR pages are billed at a higher rate than text-layer extraction. See pricing dashboard for current rates.

Related capabilities

  • document.convert_format — convert the extracted markdown to HTML, DOCX, or PDF
  • document.render_slides — render markdown as a slide deck

Examples

PDF with auto-OCR → markdown

{
  "ocr": "auto",
  "output_format": "markdown"
}