PDF

Extract text from PDF

Extract text content from a PDF document.

For native PDFs (created digitally), text is extracted directly. For scanned PDFs, OCR is used automatically when ocr_fallback is enabled.

Options

  • ocr_language: Language code for OCR (default: "eng")
  • ocr_fallback: Whether to use OCR if no text found (default: true)
post/pdf/to-text

Request

  • Base URL: https://api.filegraph.ai (the document declares no server; this is the origin it was published from)
  • URL: https://api.filegraph.ai/pdf/to-text
  • Auth: API key in header X-API-Key

Query parameters

ocr_languagestring
ocr_fallbackboolean

Response

Text successfully extracted

textstring required

Extracted text content

format_detectedstring required

Detected input format (e.g., 'pdf', 'docx', 'image')

word_countinteger required

Number of words extracted

char_countinteger required

Number of characters extracted

used_ocrboolean required

Whether OCR was used for extraction

metadataobject

Additional format-specific metadata

Example response

{
  "char_count": 892,
  "format_detected": "pdf",
  "metadata": {
    "page_count": 3
  },
  "text": "This is the extracted text from the document...",
  "used_ocr": false,
  "word_count": 150
}

Changes

No recorded changes to this operation across all 1 revision of this API.