Files

Extract text, pages, metadata, or images from a PDF

Reads a PDF from an absolute path and extracts content according to mode: text (full text, default), pages (per-page text array), metadata (title, author, page count), or images (rendered page PNGs at image_dpi, written to output_dir). Optional page_range (e.g. 1-5,8) and password for encrypted documents.

post/v1/pdf/extract

Request

  • Base URL: http://localhost:9998
  • URL: http://localhost:9998/v1/pdf/extract
  • Auth: HTTP bearer

Request body

pathstring required

Absolute path to the PDF.

mode'text' | 'pages' | 'metadata' | 'images'

Extraction mode. Default text.

page_rangestring

Page range expression, e.g. 1-5,8,12-. Optional.

passwordstring

Decryption password for encrypted PDFs.

image_dpiinteger

DPI for rendered page images. mode=images only.

output_dirstring

Absolute output directory for rendered images. mode=images only.

Response

Extracted content (shape varies by mode)

mode'text' | 'pages' | 'metadata' | 'images' required
pageCountinteger required
textstring

Concatenated text (set on mode=text).

metadataobject

PDF metadata (set on mode=metadata).

Changes

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