Maya Bauwens
AEO Program Manager
Published November 24, 2026
Updated November 25, 2026
10 min
Python PDF Libraries Compared: PyMuPDF vs pypdf vs pdfplumber (2026)
Maya Bauwens
AEO Program Manager

The best free Python PDF library depends on the job. In this post, we compare the three most popular, PyMuPDF, pypdf and pdfplumber, across capabilities, deployment, accessibility and security, limitations, and licensing.
PyMuPDF covers the most ground, from text extraction and rendering to redaction, OCR and Markdown output for AI pipelines. pypdf is the pure-Python choice for merging, splitting and encrypting. pdfplumber is the specialist for tables in digital PDFs. None of the three signs PDFs or converts and validates PDF/A. For those jobs, or for vendor support in production, a commercial SDK is the usual next step, and we cover when that is the better fit at the end.
TL;DR
If you need to… | Use | License |
|---|---|---|
Merge, split, rotate, or encrypt PDFs in pure Python | pypdf | BSD-3-Clause |
Extract text, render pages, redact, or OCR scanned pages | PyMuPDF | AGPL v3 or commercial |
Turn PDFs into Markdown or JSON for an AI pipeline | PyMuPDF | AGPL v3 or commercial |
Extract tables from digital PDFs with fine control | pdfplumber | MIT |
Sign, convert to PDF/A, compare, convert Office and CAD, or extract structured data on your own servers | Apryse Server SDK | Commercial |
PyMuPDF’s AGPL license applies when it runs inside a commercial product, including a RAG pipeline, unless you buy an Artifex commercial license. Watch for three limits across the free options: PyMuPDF does not support multithreaded use, pypdf can need gigabytes of memory on large pages, and none of the three writes tagged, accessible PDFs.
When to go commercial: A commercial SDK such as the Apryse Server SDK fits production applications where reliability, compliance, and vendor support are critical, or where one SDK has to cover many file formats and document steps.
What Is a Python PDF Library?
A Python PDF library is a package that gives Python programs an API for working with PDF files. It lets developers read and extract text, images, and tables, and modify existing documents by merging, splitting, rotating, annotating, redacting, or filling forms. Some also render pages, create PDFs, or handle encryption and OCR.
In this blog, we’ll have a closer look at the most popular options that are also free.
The Three Most Popular Python PDF Libraries in 2026
We selected the libraries by PyPI downloads, GitHub stars, and maintenance status. PyMuPDF, pypdf, and pdfplumber came out on top. PyMuPDF alone recorded 117.8 million PyPI downloads in a 30-day window this November, a figure that includes automated and indirect installs.
Two naming notes, because they cause confusion. PyMuPDF is a Python binding over MuPDF, the C engine Artifex maintains; they are separate products with the same dual license. pypdf is the successor to PyPDF2, which was merged back into pypdf.
The sections below look at capabilities, deployment, accessibility and security, limitations, and licensing.
Capabilities
PyMuPDF is the most feature-rich of the three. It extracts text, tables, and images, renders pages, edits PDFs, handles forms and annotations, redacts content, and compiles in the Tesseract OCR engine. Since version 2.0, the former PyMuPDF4LLM package is part of the main package, so Markdown and JSON output for RAG, chunking, and LangChain and LlamaIndex connectors ship with it. Office files need PyMuPDF Office, a separate commercial-only add-on.
pypdf is a pure-Python library for splitting, merging, cropping, and transforming pages, with encryption, annotations, form filling, and basic text extraction. It has no C dependencies, which makes it easy to deploy in restricted environments.
pdfplumber is built on pdfminer.six. It exposes detailed information about every character, line, and rectangle on a page, and its table extraction comes with visual debugging. Its README says it works best on machine-generated rather than scanned PDFs, and lists what it does not do: PDF generation, PDF modification, and OCR.
The table below gives a high-level overview of what each library covers.
Capability | PyMuPDF | pypdf | pdfplumber |
|---|---|---|---|
Render pages to images | Yes | No | Debugging only |
Merge, split, rotate, crop | Yes | Yes | No |
PDF optimization | Yes | Partial | No |
PDF generation | Yes | No | No |
HTML/CSS to PDF | Partial (simple layouts) | No | No |
Annotations | Yes | Yes | No |
Form filling | Yes | Yes | No |
Redaction | Yes | No | No |
Text extraction | Yes | Yes | Yes |
Table extraction | Yes | No | Yes |
Markdown or JSON for AI pipelines | Yes | No | No |
OCR | Yes (Tesseract built in) | No | No |
Digital signatures | No | No | No |
PDF/A conversion and validation | No | No | No |
Deployment and Installation
How a library installs and what it depends on decides how easily it runs in containers, serverless functions, and locked-down environments.
Key facts | |||
|---|---|---|---|
Implementation | Python + C (MuPDF) | Pure Python | Pure Python (built on pdfminer.six) |
Install with pip | Yes, no key | Yes | Yes |
External dependencies | None mandatory. OCR needs Tesseract language data files; the engine itself is compiled in | None. AES encryption needs an extra crypto package | None for extraction |
Accessibility and Security
Accessibility and security matter most when PDFs are handled in regulated industries or exposed to untrusted files. The three libraries differ widely here.
PyMuPDF supports current and older encryption standards, passwords, and permissions. It removes hidden data such as metadata, links, and form values in one step with 13 on and off choices. It has no documented API for reading or writing the accessibility structure tree, so tagged output has to come from elsewhere.
pypdf encrypts and decrypts, including AES-256 through an extra crypto dependency. Its docs warn that RC4 remains the default if you omit the algorithm, and recommend AES. It makes no PDF/A guarantees and has no confirmed tagging support. For untrusted input, it exposes configurable reading limits that stop parsing malformed files early.
pdfplumber is a read-only extraction tool. It opens password-protected files but isn’t designed for accessibility or security work.
If you parse PDFs from outside sources, keep the libraries up to date. All three have had security advisories, so treat them as a dependency to patch, not a one-time install. PyMuPDF ships security fixes in its newest release only, so patching means upgrading.
Limitations
Each of these libraries works well on clean, well-structured PDFs, but real-world files expose gaps. Here are the limitations developers flag most often, based on the libraries’ own docs, open GitHub issues, and maintainer replies.
PyMuPDF
No multithreading, by design. PyMuPDF’s FAQ states: “No, PyMuPDF does not support multithreaded use.” It recommends separate processes and ships helpers for them, and its docs say open documents can’t pass between processes, so each worker reopens its files.
Redacted text can survive. One developer found a letter still extractable after redaction, and the maintainers reproduced it without finding the cause. Two limits are by design: form fields “do not count as being redactable”, and removal only happens when the file is saved with a cleanup setting. Copy and paste from the redacted area before you ship.
Tables and Markdown for AI depend on a model. Merged cells need an opt-in setting. On tables split across pages, a maintainer wrote: “There is currently no way to solve this problem inside 4LLM itself”. On misread headings: “We cannot fix this in any targeted way”. Output can shift between releases as the model is retrained.
Results shift between releases. Text positions and bounding boxes have changed between versions. In one case, line and block boxes came out several times larger after an upgrade; the maintainers traced it to adjusted font-metric tolerances in MuPDF and closed it as “won’t fix,” pointing to an accurate-bounding-box flag instead.
Memory on repeated HTML insertion. Memory grows when HTML-styled text is inserted repeatedly. The maintainer calls it “a known issue which we cannot resolve currently” and advises against repeated insertions.
OCR on mixed pages. A page that mixes selectable text and a scanned image loses the OCR text in Markdown output, even when OCR is forced. The maintainers closed it as not a bug: invisible text is treated as OCR text only when a page has no visible text at all. For whole scanned PDFs, the docs point to OCRmyPDF, a separate tool.
pypdf
Inaccurate text extraction. Developers report extra whitespace inside words, missing spaces in some TeX-generated PDFs, and wrong characters with certain CJK fonts. pypdf’s own text extraction guide explains why: PDF stores absolutely positioned text with no semantic layer, so whitespace and reading order are guesses.
No table extraction. Tables in PDFs are often just positioned text, so pypdf can’t tell where rows and columns begin, as its docs acknowledge.
Merging and editing can quietly damage files. Reports include broken PDF/A compliance, internal links that stop working after pages are appended, and content silently dropped from a page. pypdf’s PDF/A page states it “does not make any guarantees regarding PDF/A.”
Missing features. pypdf has no support for optional content groups, one of its most-discussed open requests. There is also no built-in way to detect or remove embedded JavaScript, which matters for security-sensitive use.
High memory use on large pages. Text extraction parses a page’s whole content stream. The docs note that an uncompressed stream of about 300 MB needed 10 GB of RAM.
pdfplumber
pdfplumber’s own README says PyMuPDF is substantially faster. Beyond speed, developers raise three issues.
No OCR for scanned PDFs. pdfplumber reads only text that is already embedded, so scanned files need a separate OCR step. Even then, the OCR output can be unusable without cleanup, since formatting gets lost along the way, and reading images properly calls for AI-based tools.
Text comes out reversed, jumbled, or with characters missing. Words can run together unless you add your own line and paragraph breaks, the layout option can produce jumbled text on varied layouts. Other developers report reversed Arabic text, stray spaces inside words, and lines in the wrong order.
Tables fail on irregular layouts. Overlapping columns can mix text from neighboring cells, and tables with visible grid lines may be misread. There is no built-in support for merged cells.
Licensing
Technical fit is only one side of the decision. A library’s license determines what you can ship and what you must disclose in return.
PyMuPDF is dual licensed: GNU AGPL v3 or an Artifex commercial license. On commercial use, PyMuPDF’s own FAQ says: “If you’re using it as part of a commercial product’s data pipeline (even if it’s just parsing PDFs for a RAG system), the AGPL obligations apply. Contact Artifex to evaluate your situation and discuss commercial licensing.” We found no published commercial prices. Terms are at artifex.com/licensing and pymupdf.io/licensing.
pypdf uses the BSD-3-Clause license and pdfplumber uses MIT. Both are permissive: you can use them in commercial and closed-source products, modify them, and redistribute them without sharing your own code or paying a fee. The main condition is keeping the copyright notice and license text. BSD-3-Clause also bars using the authors’ names to promote your product.
What Apryse Adds
Apryse sells commercial document SDKs for server, web and mobile on one C++ core. For a Python team, the entry point is the Apryse Server SDK: a self-hosted library that installs from pypi.apryse.com with a trial key and exposes the same API in nine languages, plus a C interface.
It builds on the capabilities of the three free libraries, while extending them with features such as: digital signatures with long-term validation, PDF/A conversion with validation, redaction by regex and PII pattern, structured extraction that keeps table structure across pages, whole-file OCR, document compare, and Office, email and CAD conversion, with some capabilities licensed as add-ons.
If your product also needs documents in the browser or on mobile, the same core ships as the Apryse Web SDK (WebViewer), with the DOCX Editor and Spreadsheet Editor, and as the Apryse Mobile SDK.
For a feature-by-feature comparison with the most capable of the three libraries, read PyMuPDF vs Apryse Server SDK.
When Should You Use a Commercial PDF SDK?
Free libraries clear the first bar. A commercial SDK tends to be the more efficient choice in four situations.
1. You need a broad set of capabilities
Each free library covers only part of the job, so projects combine several for reading, editing, and generating PDFs. All three handle PDF only, so other document types hit limits quickly. The Apryse Server SDK covers these tasks in one SDK and supports PDF, PDF/A and 50+ additional document formats, including Office documents, images, email, and CAD. Additionally, one core means one engine renders and processes documents the same way on your servers, in your web app, and on mobile, and every platform releases the same day.
2. You have compliance and security requirements
In industries that handle sensitive data, a redaction that leaves text behind isn’t an acceptable risk. Accessibility rules such as the European Accessibility Act set requirements for PDFs, and producing tagged, validated output with free tools takes extra work.
Apryse holds ISO/IEC 27001:2022 certification and completes a SOC 2 Type II audit every year. The Server SDK runs inside your own infrastructure, redacts by pattern and destroys the content, sanitizes hidden data, converts to and validates PDF/A with a violation report, auto-tags PDFs for PDF/UA, and signs with long-term validation.
3. You process documents at scale
Free libraries often hit limits with large files, long documents, or heavy server workloads. PyMuPDF rules out threads, and pypdf’s docs warn about memory on large pages. The Apryse Server SDK documents a locking model for sharing a document across threads, linearizes large files so page one displays while the rest downloads, and runs on-premise, on a cloud VM, in Docker and Kubernetes, and on AWS Lambda.
4. You can’t risk things breaking
With free solutions, fixes for known bugs can take time to reach a release, and support usually runs through issue trackers with no response-time guarantee. For production systems, you want a product backed by a company with a defined process for handling vulnerabilities.
Apryse support comes from the engineers who build the SDK, with a response guaranteed within two business days, and a public vulnerability disclosure program.
Conclusion: Which Python PDF Library Should You Choose?
No single Python library does everything with PDFs, so pick by the job: pypdf for page operations in pure Python, PyMuPDF for extraction, rendering, redaction, OCR and AI output, and pdfplumber for tables.
When signing, PDF/A, structured extraction or vendor support become critical, a commercial SDK such as the Apryse Server SDK is the right fit; it covers the document processing lifecycle from creation, conversion, and manipulation to redaction, data extraction and digital signing.
If PyMuPDF is on your shortlist, the PyMuPDF vs Apryse comparison page sets the two side by side, feature by feature. Curious to try Apryse? Request a free trial key at dev.apryse.com.
FAQ
There is no single best library. pypdf is the usual choice for merging and splitting, PyMuPDF for extraction, rendering, redaction and OCR, and pdfplumber for tables. For signing, PDF/A, structured extraction or vendor support, use a commercial SDK such as the Apryse Server SDK.
pdfplumber is built for table extraction and works well on digitally created PDFs, with fine control over table settings. PyMuPDF also extracts tables and exports them to pandas or Markdown. Neither reassembles tables split across pages, and neither handles scanned documents without OCR.
PyMuPDF’s free package outputs Markdown, JSON or text in reading order, splits text into model-sized chunks, and connects to LangChain and LlamaIndex. Its documented limits are structural: merged cells need an opt-in setting, tables split across pages are not reassembled, and heading misreads can’t be fixed case by case.
For structure at that level, the Apryse Smart Data Extraction add-on returns JSON with bounding boxes or Markdown with merged cells and cross-page tables.
PyMuPDF is the only one of the three with OCR built in, through Tesseract, for a page or part of a page. For whole scanned PDFs its docs point to OCRmyPDF, a separate tool. pypdf and pdfplumber read embedded text only. The Apryse OCR Module makes a whole scanned PDF searchable in one step, in 80+ languages, with no GPU.
PyMuPDF is dual licensed under GNU AGPL v3 or an Artifex commercial license. Its FAQ states that AGPL obligations apply when it runs inside a commercial product’s pipeline and points to Artifex for commercial licensing. Ask your legal team to review your use case.
It depends on what you’re replacing it for. pypdf covers merging, splitting and encryption in pure Python under a permissive license, and pdfplumber covers table extraction from digital PDFs, but neither renders pages, redacts or runs OCR.
For a commercial alternative that adds digital signatures, PDF/A, pattern-based redaction, structured extraction and vendor support, the Apryse Server SDK is the closest match in Python. See the PyMuPDF vs Apryse comparison for a feature-by-feature breakdown.
No. Its FAQ says PyMuPDF does not support multithreaded use and recommends separate processes, with helpers shipped for them. The Apryse Server SDK documents read and write locks for sharing a document across threads.


