Signature
Parameters
str | pymupdf.Document
required
Path to the document file, or an already-opened
pymupdf.Document instance. Supports PDF, XPS, eBooks, and — with PyMuPDF Pro — Office formats.various
Additional parameters are shared with
to_markdown(). See the to_markdown() API reference for details.Returns
string
When
page_chunks=False (default). A single plain text string containing all extracted pages.list
When
page_chunks=True. A list of dictionaries, one per extracted page, each with the following keys:Raises
Examples
Minimal
Page chunks
Save to file
See Also
Extract Text Guide
Full guided overview.
to_markdown()
Markdown output preserving document structure.
to_json()
Structured output with bounding boxes and layout data.