PyMuPDF Alternatives: 6 Tools Compared for PDF Processing in Python
PyMuPDF Alternatives: 6 Tools Compared
PyMuPDF is one of the fastest PDF libraries available in Python — text extraction, image extraction, and page rendering all run an order of magnitude quicker than pure-Python alternatives. But speed isn't the only thing that matters when you're picking a dependency. PyMuPDF is licensed AGPL-3.0, which means using it inside a closed-source commercial product either requires a paid Artifex license or open-sourcing your own codebase under the same terms. That single fact sends a lot of developers looking for a substitute. This guide covers six real alternatives, what each trades off against PyMuPDF, and when file2markdown is the simpler option if you don't want to manage a PDF library at all.
Why Look Beyond PyMuPDF?
People go searching for a PyMuPDF alternative for a handful of recurring reasons:
- The AGPL-3.0 license — the most common reason by far. AGPL requires that if you distribute software built on PyMuPDF (including running it as a network service), you make your own source available under AGPL too, unless you buy a commercial license from Artifex. For details on exactly what this requires, see Is PyMuPDF Free for Commercial Use?
- OCR isn't self-contained — PyMuPDF has an OCR API (
get_textpage_ocr), but it works by calling out to Tesseract-OCR, which you have to install separately as its own application; there's no scanned-page text extraction out of the box - Table extraction is manual — PyMuPDF gives you positioned text spans and rectangles, not structured tables; you have to reconstruct table layout yourself or lean on its newer table-finding heuristics
- It's still just a library — every workflow using PyMuPDF needs a Python environment, error handling, and a pipeline wrapped around it; there's no hosted API in the open-source package
Which alternative makes sense depends on which of these is actually your blocker.
The Alternatives at a Glance
| Tool | License | Best for | OCR |
|---|---|---|---|
| pypdf | BSD | Pure-Python, permissive license, basic extraction | No |
| pdfplumber | MIT | Table and layout extraction | No |
| pypdfium2 | Apache-2.0 / BSD | Raw extraction speed without AGPL | No |
| Docling | MIT | Layout-aware parsing of complex PDFs | Yes |
| Unstructured | Apache-2.0 | Typed element partitioning for RAG | Yes |
| file2markdown | — (hosted) | No install, browser or API | Yes |
pypdf — Best for a Permissive License
pypdf is the direct license swap: it's pure Python, BSD-licensed, and has no C-extension or AGPL obligations at all. It's the modern, maintained successor to the old PyPDF2 project and handles text extraction, merging, splitting, and page manipulation without pulling in any native dependencies.
from pypdf import PdfReader
reader = PdfReader("report.pdf")
text = "\n".join(page.extract_text() for page in reader.pages)
The trade-off is speed and extraction quality: pypdf is meaningfully slower than PyMuPDF on large PDFs, and its text extraction can mangle spacing on complex, multi-column layouts where PyMuPDF's native parser does better. Full comparison, including benchmarks, in pypdf vs PyMuPDF.
pdfplumber — Best for Tables and Layout
pdfplumber is MIT-licensed and built specifically for extracting structured data — tables, word positions, and character-level bounding boxes — rather than just flat text. If your pipeline's actual bottleneck is pulling clean tables out of invoices or reports, pdfplumber's table-finding logic is more purpose-built than PyMuPDF's.
It's also noticeably slower than PyMuPDF on large documents, since it builds a much more detailed object model of each page. See pdfplumber vs PyMuPDF for the full trade-offs on speed, table accuracy, and Markdown output quality.
pypdfium2 — Best for Speed Without AGPL
If the reason you're looking at PyMuPDF in the first place is raw speed, pypdfium2 is the closest match without the licensing baggage. It wraps Google's PDFium engine (the same renderer behind Chrome's PDF viewer), is licensed Apache-2.0/BSD, and handles text extraction and page rendering quickly with no network-service obligations.
pip install pypdfium2
The catch: it's a lower-level binding than PyMuPDF. You get text and rendering primitives, not PyMuPDF's higher-level helpers for annotations, forms, or PDF editing — so expect to write more glue code for anything beyond extraction.
Docling — Best for Layout-Accurate Parsing
Docling is IBM Research's open-source library for document understanding. Instead of extracting positioned text spans like PyMuPDF, it runs an AI layout model that reconstructs reading order, detects tables, and outputs clean Markdown or structured JSON directly — useful if you're converting PDFs for an LLM or RAG pipeline rather than just pulling text out.
It's MIT-licensed, so there's no AGPL concern, but it's a much heavier install (it pulls in PyTorch and downloads model weights on first run) and is slow without a GPU. Full trade-offs against a PyMuPDF-based pipeline in PyMuPDF4LLM vs Docling.
Unstructured — Best for RAG Partitioning at Scale
Unstructured takes a different approach entirely: instead of flat text or Markdown, it partitions a document into typed elements — titles, list items, tables, narrative text — each with page and coordinate metadata. If you're feeding a RAG pipeline and want to filter or route content by element type before chunking, that structured output is more directly usable than anything PyMuPDF returns natively. It's Apache-2.0 licensed and ships both an open-source library and a hosted API.
file2markdown — No Install, Browser or API
Every option above is still a Python library you have to install, wire into error handling, and keep updated. file2markdown.ai skips that entirely: upload a file in the browser or call the API, and get clean Markdown back, with OCR included for scanned pages. Beyond PDF, it also handles DOCX, XLSX, CSV, PPTX, JSON, HTML, EPUB, XML, and images — so you're not maintaining a different library for every file type your pipeline touches.
If the whole reason you're evaluating PyMuPDF alternatives is the AGPL license, this sidesteps the question entirely: you're calling a hosted service, not shipping a derivative work.
How to Choose
- AGPL is a hard blocker for your legal team → pypdf, pdfplumber, pypdfium2, Docling, or Unstructured (all permissively licensed).
- Need the closest thing to PyMuPDF's raw extraction speed → pypdfium2.
- Pulling structured tables out of PDFs → pdfplumber.
- Converting PDFs to Markdown for an LLM or RAG pipeline, and layout accuracy matters more than install size → Docling.
- Building a RAG pipeline that needs typed, chunk-ready elements → Unstructured.
- Don't want to install, update, or license-audit a PDF library at all → file2markdown.ai.
These aren't mutually exclusive — a common pattern is pypdfium2 or pdfplumber for simple in-house scripts, and file2markdown or Docling for the harder documents that need real layout handling. Once you have clean Markdown out of any of these, see the guide on chunking Markdown for vector databases or the full RAG document prep pipeline.
Frequently Asked Questions
What is the best free alternative to PyMuPDF?
pypdf and pdfplumber are both free, permissively licensed (BSD and MIT respectively), and have no AGPL obligations. Neither matches PyMuPDF's raw extraction speed, but for most document-processing scripts the difference isn't noticeable until you're working through thousands of PDFs. If you want to avoid installing a library at all, file2markdown.ai's web converter is free for casual conversions.
Is PyMuPDF actually free to use?
PyMuPDF itself is free and open source, but its AGPL-3.0 license has real requirements once you distribute or host software built on it: you either release your own source under AGPL-3.0 or buy a commercial license from Artifex. Internal, non-distributed scripts aren't affected by AGPL's terms in the same way. See Is PyMuPDF Free for Commercial Use? for the full breakdown.
Is pypdf as fast as PyMuPDF?
No — pypdf is pure Python and meaningfully slower than PyMuPDF, which wraps a compiled C library (MuPDF). For small batches the difference rarely matters; for high-volume processing it can add up. pypdf vs PyMuPDF has benchmark numbers.
Does PyMuPDF have OCR?
It has an OCR API, but not a self-contained one: get_textpage_ocr() works by calling Tesseract-OCR, which you must install separately as its own application — PyMuPDF doesn't bundle an OCR engine. Docling, Unstructured, and file2markdown all include OCR as part of their pipeline with nothing extra to install.
The Markdown Memo
A fortnightly note for lawyers, researchers, accountants, and anyone else drowning in PDFs, scans, and decks. No spam.