pdfmux/blog
python

PyMuPDF vs Marker: Which PDF Extraction Library to Use in Python

TL;DRPyMuPDF vs Marker compared: license, speed, GPU needs, table and OCR handling, and which one to pick for fast text extraction vs scanned/academic documents.

Direct answer: PyMuPDF and Marker solve different problems, so “which is better” depends on what the PDF actually is. PyMuPDF (import fitz) is a fast, low-level C library for extracting text, images, and basic structure from PDFs that already have a text layer — no GPU, no ML models, AGPL-licensed (commercial license available from Artifex). Marker is a deep-learning pipeline that converts PDFs — including scanned ones — into Markdown using a multilingual vision model (Surya) for OCR, layout, and equations; it’s Apache 2.0 for the code with a separate research-friendly license on the model weights. Pick PyMuPDF for fast extraction from digital PDFs at scale. Pick Marker for scanned, equation-heavy, or academic documents where you want Markdown out the other end and have GPU budget. pdfmux sits between them — it runs the PyMuPDF-speed path first and only pays for OCR or an LLM fallback on pages that need it.


At a glance

PyMuPDFMarker
What it isPDF parsing/rendering library (Python bindings over the MuPDF C engine)PDF-to-Markdown conversion pipeline (deep learning models)
License (code)AGPL v3, commercial license from ArtifexApache 2.0
License (models)N/A — no bundled ML modelsModified AI Pubs Open RAIL-M (free for research/personal/small startups)
Input formatsPDF, XPS, EPUB, and other MuPDF-supported formatsPDF, images, PPTX, DOCX, XLSX, HTML, EPUB
OutputPlain text, structured dict, HTML, XML, images, rendered pagesMarkdown, JSON, HTML, chunked text
OCRVia external engine (Tesseract or RapidOCR)Built-in multilingual VLM (Surya)
GPU requiredNoSupported (GPU/CPU/Apple Silicon); published benchmarks assume GPU for best accuracy
Table handlingBasic table detectionVLM-assisted table reconstruction
EquationsNot a focusInline math and LaTeX recognition
Speed characterBuilt for raw extraction throughputBuilt for conversion fidelity on hard documents

Sources: PyMuPDF, Marker.


License is the first filter, not an afterthought

This is where the two libraries diverge the most, and it’s worth settling before you write any code.

PyMuPDF is AGPL v3. That’s free if your own project is also open source, or if you’re using it internally and never distributing the software. If you’re shipping a closed-source product that bundles PyMuPDF, AGPL’s network-use clause means you either open-source your code or buy a commercial license from Artifex Software, the company that maintains the underlying MuPDF engine. This catches teams off guard more than any feature gap — budget for it before you commit.

Marker’s code is Apache 2.0 — permissive, no copyleft obligation. But the model weights it pulls down at install time carry a separate modified AI Pubs Open RAIL-M license: free for research and personal use, and for startups under roughly $5M in funding or revenue, with different terms above that threshold. Two licenses, two different documents to read — check both before you ship.

Older comparisons on this blog (including Docling vs Marker) describe Marker as GPL-3.0; that was accurate at the time of writing but the project has since relicensed its code to Apache 2.0. If you’re citing Marker’s license anywhere, confirm against the current LICENSE file in the repo rather than an older post — ours included.


Installing and running each

PyMuPDF:

pip install pymupdf
import fitz

doc = fitz.open("report.pdf")
text = "".join(page.get_text() for page in doc)

No model download, no GPU check, no warm-up. It imports and runs in milliseconds on top of whatever Python already has loaded.

Marker:

pip install marker-pdf
from marker.converters.pdf import PdfConverter
from marker.models import create_model_dict
from marker.output import text_from_rendered

converter = PdfConverter(artifact_dict=create_model_dict())
rendered = converter("report.pdf")
markdown, _, images = text_from_rendered(rendered)

create_model_dict() downloads the Surya model weights on first run — expect a one-time multi-gigabyte download and a cold-start delay before the first page converts, independent of document size.


Accuracy and speed: why there’s no single number

PyMuPDF doesn’t publish an end-to-end accuracy benchmark, because it isn’t an end-to-end OCR system — it’s a text-layer extraction and rendering primitive. The comparison its own documentation makes is between OCR engines you can plug into it: on the ExtractBench corpus, RapidOCR scores 85.20% versus Tesseract’s 78.31%. That tells you which OCR engine to pair with PyMuPDF, not how PyMuPDF compares to Marker on a full document.

Marker publishes its own numbers on olmocr-bench (1,403 PDFs), measured on a B200 GPU:

ModeAccuracyThroughput
Balanced (full OCR pipeline)76.0%2.9 pages/sec
Fast66.6%7.4 pages/sec
Fast, no-OCR (CPU)43.6%23.7 pages/sec

Those three rows are the honest range: Marker’s accuracy drops hard the moment you turn off the expensive OCR pipeline, and the GPU-backed modes are the ones the benchmark headline numbers describe. There’s no published head-to-head between PyMuPDF and Marker on the same corpus, so don’t trust a specific “X% more accurate” claim from either side that isn’t linked to a benchmark you can reproduce — including on this blog. For a benchmark that does put multiple extraction tools (including Marker and PyMuPDF-based tools) through the same corpus, see the full extractor benchmark.


When to use PyMuPDF

  • Your PDFs are born-digital (exported from Word, LaTeX, a web page, an invoicing system) — there’s a real text layer, so you don’t need ML to read it.
  • You’re processing high volume and care about CPU cost — PyMuPDF runs fine on commodity instances with no GPU line item.
  • You want more than text: image extraction, page rendering, form fields, and redaction all live in the same package.
  • You can either open-source your own code or budget for an Artifex commercial license.

When to use Marker

  • Your documents are scanned, photographed, or otherwise image-only, and you want Markdown out without wiring your own OCR step.
  • You’re converting academic papers, textbooks, or technical reports with equations and complex multi-column layout.
  • You have GPU capacity (or can tolerate the CPU accuracy drop in the table above) and conversion fidelity matters more than raw throughput.
  • Your usage fits inside the Open RAIL-M model-weight terms, or you’ve confirmed it doesn’t and budgeted accordingly.

If Docling is also on your shortlist — a third option that’s MIT-licensed and CPU-friendly — Docling vs Marker covers that pairing directly, and PyMuPDF vs pdfplumber covers the lighter-weight, layout-focused alternative to PyMuPDF itself.


Where pdfmux fits

Most real batches aren’t purely born-digital or purely scanned — they’re a mix, and you don’t know the split until you look. pdfmux runs the PyMuPDF-speed path first, audits each page, and only routes the pages that fail — scanned, garbled, low-confidence — to OCR or an LLM fallback:

import pdfmux

result = pdfmux.convert("mixed-batch.pdf")
print(result.markdown)
print(result.confidence)

It scores 0.903 overall on opendataloader-bench, #2 of 8 engines tested (both PyMuPDF-based and ML-based), just behind opendataloader-hybrid at 0.909. MIT licensed, pip install pdfmux, no GPU required. See pdfmux vs PyMuPDF and pdfmux vs Marker for the direct comparisons.

Frequently asked questions

Is Marker free to use commercially?

The Marker code is Apache 2.0, which is permissive. The model weights it downloads at runtime ship under a modified AI Pubs Open RAIL-M license — free for research, personal use, and startups under roughly $5M in funding or revenue, with different terms above that. Read the license file in the repo before shipping Marker inside a paid product; the code license and the weights license are not the same thing.

Is PyMuPDF free to use commercially?

PyMuPDF ships under AGPL v3, which is free for open-source projects but requires either open-sourcing your own code or buying a commercial license from Artifex (the company behind the underlying MuPDF engine) if you're shipping closed-source software. This is the single biggest practical difference between the two libraries for a company evaluating them.

Does PyMuPDF do OCR like Marker does?

PyMuPDF integrates with external OCR engines (Tesseract or RapidOCR) rather than shipping its own OCR model — you render the page to an image and hand it to the OCR engine yourself. Marker ships its own multilingual vision-language OCR model (Surya) as part of the pipeline, so it handles scanned pages without you wiring in a separate OCR step.

Can I run Marker without a GPU?

Yes. Marker runs on CPU or Apple Silicon (MPS) in addition to GPU, but its own published benchmarks show throughput dropping sharply off GPU — its fast, no-OCR CPU mode scores lower accuracy and the balanced/accuracy modes that use the full OCR pipeline are the ones built around GPU batching.