PyMuPDF4LLM vs pdfplumber vs Marker, Tested on Real PDFs

By pdftomd.tools team · Updated · 8 min read

Short answer from our tests: pymupdf4llm is the best default, fast and with the cleanest headings, if its AGPL licence suits you. pdfplumber, under MIT, is the most exact on ruled tables but gives you no headings. marker handles borderless tables best and strips page clutter, but on a CPU it is several times slower and it damaged our Chinese text. For one-off files, our Python PDF to Markdown guide also covers a no-install route.

Illustration: three labelled test tubes of Markdown output poured from one PDF

PyMuPDF4LLM vs pdfplumber vs Marker: the verdict

Which library to pick, in our tests
If you needPickWhy
Good Markdown fast, headings includedpymupdf4llmAll expected headings at the right level on all three documents
Exact cells from ruled tables, permissive licencepdfplumberExact on ruled and merged-cell grids; MIT licence
Borderless tables, no running headersmarkerFound both simple borderless samples; removed headers and page numbers
Chinese or Japanese textpymupdf4llmFull character coverage and punctuation kept; marker lost characters

No library won every test. The rest of this article shows the numbers behind each line, so you can weigh pymupdf4llm vs pdfplumber vs marker against the PDFs you actually have.

How we tested: hardware, versions, documents

To make pymupdf4llm vs pdfplumber vs marker a fair comparison, every library got the same files on the same machine. All runs were CPU only pdf parsing: Intel(R) Xeon(R) Processor, 8 vCPUs, 16 GB RAM, no GPU, Linux 6.12.94+ x86_64, Python 3.13.5. Versions: pymupdf4llm 1.28.2 (PyMuPDF 1.28.2), pdfplumber 0.11.9 (pdfminer.six 20251230), marker-pdf 2.0.0 (surya-ocr 0.22.1, torch 2.14.1+cpu). Tokens were counted with tiktoken 0.14.0 and the o200k_base encoding. We ran the test on October 19, 2026.

Illustration: one CPU box running three Python libraries on the same three PDFs and a set of table samples
Same files, same machine, same scoring for all three libraries.
  • Documents: a 5-page English guide with 13 headings and a table; an 11-page Chinese report with 29 headings and 4 tables; a 4-page English report with a running header and page numbers on every page.
  • Table samples: 11 one-page PDFs whose correct tables we know cell by cell, including two with no table at all.
  • Settings: each library’s defaults. pdfplumber has no Markdown output, so we wrote about 20 lines that place its text lines and find_tables() results in reading order. marker ran once with defaults (fast mode, which is its CPU default) and once with --disable_ocr.
  • Timing: the median of three runs. marker’s models were loaded once beforehand (4.79 seconds) and a warm-up run was discarded.
import pymupdf4llm
md = pymupdf4llm.to_markdown("report.pdf")

import pdfplumber
with pdfplumber.open("report.pdf") as pdf:
    for page in pdf.pages:
        lines = page.extract_text_lines()
        tables = page.find_tables()

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())
md, _, _ = text_from_rendered(converter("report.pdf"))
The core call of each library. Our full script, with scoring, is about 220 lines.

On a CPU, marker 2.0 also needs a llama-server binary from llama.cpp, which its README asks you to install separately, and on first use it downloaded about 1.8 GB of model files on our box. Our first two attempts failed: once on a torch/torchvision mismatch, once because llama-server was missing. Both were setup problems, not bugs in the library, but budget time for them.

Speed and token counts

Median seconds per document and tiktoken count of the output, in our tests
LibraryEnglish guide (5 p.)Chinese report (11 p.)English report with running headers (4 p.)Tokens, Chinese report
pymupdf4llm0.693 s1.419 s0.387 s8908
pdfplumber0.713 s3.579 s0.023 s8782
marker (default)3.354 s4.563 s2.325 s10001
marker (--disable_ocr)1.425 s3.146 s0.447 s10001

Speed is where pymupdf4llm vs pdfplumber vs marker differs most. pdfplumber was the fastest on the short report (0.023 s) but the slowest of the light tools on the Chinese one. pymupdf4llm stayed between about 0.1 and 0.14 seconds a page throughout. marker was 5 times slower than pymupdf4llm on the English guide even with its models already loaded; with --disable_ocr the gap shrank.

Token counts were close for the two light libraries. marker produced about 12% more tokens on the Chinese report, partly from <sup> tags and extra spacing, and fewer on the short report, because it dropped the repeated headers.

Headings and page clutter

Expected headings found, and how many at the right level, in our tests
LibraryEnglish guide (13)Chinese report (29)English report with running headers (4)
pymupdf4llm13 (13 right level)29 (29 right level)4 (4 right level)
pdfplumber0 (0 right level)0 (0 right level)0 (0 right level)
marker (default)11 (4 right level)23 (14 right level)4 (3 right level)
marker (--disable_ocr)11 (4 right level)23 (14 right level)4 (3 right level)

Headings are the second big split in pymupdf4llm vs pdfplumber vs marker. pymupdf4llm found every heading at the right level. It also marked the guide’s bold FAQ questions as headings (6 lines), which is arguably useful. pdfplumber has no notion of headings, so you get flat text. marker found most headings but often at the wrong level.

On the 4-page report, pymupdf4llm and pdfplumber both kept all 4 copies of the running header and all 4 page numbers; marker removed both. This is the clearest case for pymupdf4llm vs marker: marker’s layout model knows what a page header is, the light libraries do not. pdfplumber also left a word split by a line-end hyphen.

Screenshot: pymupdf4llm vs pdfplumber vs marker raw Markdown output of the same 4-page report in three columns
Screenshot: the raw Markdown each library wrote for our 4-page report, unedited.

Tables: ruled, borderless, merged

Result on each table sample, in our tests
Samplepymupdf4llmpdfplumbermarker
Ruled gridexactexactexact
Office export81% of cellsexact94% of cells
Borderless40% of cellsnot found90% of cells
Wrapped cellsexactexact83% of cells
Borderless, wrappednot foundnot found83% of cells
Office, borderlessnot foundnot foundnot found
Table inside textexactnot foundexact
Two tablesexact33% of cellsexact
Merged cells83% of cellsexact42% of cells
Exact tables: pymupdf4llm 4, pdfplumber 4, marker 3 of 9. On the two samples with no table, no library invented one. marker with --disable_ocr scored the same as default marker on every sample.

On tables, the ranking of pymupdf4llm vs pdfplumber vs marker depends on whether the PDF draws lines. pdfplumber tables are exact when the PDF draws its grid lines, including merged cells, because find_tables() follows the ruling. Without lines it found nothing. pymupdf4llm was exact on most ruled tables, but broke one Office table where a cell contained a | it did not escape. marker found both simple borderless samples, at 83–90% of cells, where pymupdf4llm found one at 40% and pdfplumber found neither; but marker merged columns in the merged-cell sample.

No library got the borderless table from an Office export. If tables are what you need, our PDF tables guide explains why borderless layouts are hard for every tool.

Chinese text: coverage, spaces, punctuation

11-page Chinese report, in our tests
LibraryChinese characters keptSpaces inside sentencesLine breaks inside sentencesFull-width commas kept
pymupdf4llm100%1590100%
pdfplumber100%0140100%
marker (default)98.6%16600%

Chinese text reorders pymupdf4llm vs pdfplumber vs marker once more. The source PDF has no spaces inside its sentences. pymupdf4llm kept every character and every full-width comma, but added 159 spaces inside sentences. pdfplumber kept the characters too, but left 140 line breaks in the middle of sentences. marker lost 1.4% of the characters, including some section headings, turned every full-width comma into an ASCII comma, and added 152 <sup> tags. For Chinese PDFs, the marker pdf output needed the most repair in our tests.

Licences: AGPL vs MIT vs Apache, plus model terms

Illustration: three licence cards, one per library, with a separate card for marker's model weights
The code licence is not the whole story for marker: its model weights have their own terms.
  • pdfplumber: MIT, per its LICENSE file. Use it in closed-source and commercial code with the notice kept.
  • pymupdf4llm and PyMuPDF: the repositories ship the GNU AGPL 3.0, and the package metadata says “Dual Licensed - GNU AFFERO GPL 3.0 or Artifex Commercial License”. In short, if you distribute a program built on it, or let users reach a modified version over a network, the AGPL expects you to share that program’s source under the same licence, unless you buy a commercial licence from Artifex.
  • marker: the code is Apache-2.0, but the model weights use a modified AI Pubs Open RAIL-M licence. Per its MODEL_LICENSE, the weights are free for research, personal use and organisations under $5M in gross revenue or funding; above that you need a licence from Datalab.

If licensing decides pymupdf4llm vs pdfplumber vs marker for you, AGPL vs MIT is the real choice for most commercial teams between the two light libraries, and marker adds a revenue test. This is a summary, not legal advice; read the licence files before you ship.

FAQ

Which is best: pymupdf4llm vs pdfplumber vs marker?

In our tests, pymupdf4llm for general documents and Chinese text, pdfplumber for exact ruled tables under MIT, and marker for borderless tables and pages with running headers.

Is pymupdf4llm free for commercial use?

Under the AGPL, yes, if you also release your source when you distribute or serve the program. Otherwise Artifex sells a commercial licence.

Does marker need a GPU?

No. It ran on our 8-vCPU box with no GPU, but it needed llama.cpp’s llama-server and was several times slower than the light libraries.

Can pdfplumber output Markdown?

Not directly. It gives you text, words, lines and tables; you write the Markdown yourself, as we did for this test.

Which library handles scanned PDFs?

marker is the one built around OCR models. With their default settings, pymupdf4llm and pdfplumber read the text layer, so a scan comes out empty.

Can I reproduce this pymupdf4llm vs pdfplumber vs marker test?

Yes. The script, the versions and the hardware are listed above; timings will differ on another machine, while the quality scores should not.