PDF Split and Merge: Two Tools We Actually Ran, Verbatim Results
A 4-page test deck, two pages split out, a split half merged back onto a full deck — pypdf and PyMuPDF both handled the core job (4 pages in, 2 pages split out, 6 pages after merge, correct page text in the right order). The one thing both tools lost was the original document title in the file metadata: after merging, PyMuPDF's output carried an empty title field and pypdf's carried only a producer tag of its own. If your pipeline depends on document titles (search indexing, DMS filing), either tool will make you re-set it after a merge. Everything below is from a run executed today; page counts and text are quoted verbatim; no accuracy percentages, no prices.
Day 10 of our 28-day series. Same rules as yesterday's runs (PDF tools we ran, Markdown to PDF we ran): only tools we executed get a row; not-run items get a stated reason; the test file recipe is printed so you can reproduce it.
The test deck (reproduce it in 30 seconds)
Four pages of one page of plain text each, generated with PyMuPDF and saved as test_deck.pdf:
Page 1 heading: Page 1 of Test Deck. Page 2 heading: Page 2 of Test Deck. Pages 3 and 4 follow the same pattern, plus one body line per page. Deliberately simple: split and merge are page-level operations, so structure/tables are irrelevant here — the test measures page fidelity and metadata handling, not content extraction. We then gave a copy a real document title (Test Deck Orig) with PyMuPDF and used that copy for the metadata check.
Comparison table — both tools ran, all result fields from the runs
| Operation | pypdf result (verbatim) | PyMuPDF result (verbatim) | Read of the result |
|---|---|---|---|
| Read deck | 4 pages recognized | 4 pages recognized | Identical — no difference at the open/read step |
| Split (keep pages 1 and 3) | Writer with 2 pages, saved successfully; extracted text from saved output matched: page text Page 1 of Test Deck plus its body line came back intact | New document with pages 1 and 3 inserted via from-page/to-page range; reopened file reports exactly 2 pages | Both correct at the page level; pypdf needed a page-add loop, PyMuPDF took a range in one call |
| Merge (split half onto full deck) | Merged output reads exactly 6 pages | Merged output reads exactly 6 pages | Identical page counts — the core job works in both |
| Document title after merge | Title gone: metadata of the merged file contained only the producer tag, no original title | Title gone: metadata title field came back empty after merge | The finding of the day: merges are page-graph operations, titles live elsewhere, and neither tool carries it for you |
The runs, in order
Run 1 — pypdf split and merge. We opened the 4-page deck (reader reported 4 pages), added pages 0 and 2 to a new writer, saved, then appended the split file to a full copy of the deck and saved again. Reopening the merged file: 6 pages, in the expected order. Page text extracted from the merged output matched the source deck line for line.
Run 2 — PyMuPDF split and merge. Same deck, same intent: a new document built with an insert-pdf call covering the page range, saved (reopened: 2 pages), then inserted ahead of a full deck copy (reopened: 6 pages). Extraction from the merged file matched the source pages.
Run 3 — the metadata check. We set a real title on a deck copy, merged it with each tool, and read the title field back. PyMuPDF merge: empty title. pypdf merge: only the producer tag remained. This is not a pypdf bug or a PyMuPDF bug — it is how page operations work: the title is document-level metadata, and a merge that rebuilds the document structure does not inherit it automatically. The fix takes one line per output (set the title on the writer before saving), which we verified works with the same libraries.
What we could NOT test — and refuse to guess
- Full-page-image, form-field and outline/bookmark preservation across merges — not run. Reason: our test deck is text-only and has no bookmarks, forms or link annotations, so any preservation number we printed would be about a file we never made. if your files carry bookmarks you must test with your own file.
- Command-line utilities (qpdf, pdftk) and online splitters — not run. Reason: the runs above answer the Python-library question which was this page's scope; online upload services additionally fail our privacy bar for the confidential-documents route, which is a principle judgment, not a test result.
- Speed and file-size numbers — not run. The only numbers on this page are page counts and one exit-observed order check, all counted from outputs in front of us.
Decision rule this run actually supports
- Already in Python and want the shortest merge: PyMuPDF's range-insert did the same job as pypdf's loop with fewer lines; both were one save call away from a correct 6-page result.
- Need to re-set document metadata after merge anyway: pick either tool — you are adding one line of title-setting code regardless, because both dropped the title in our runs.
- One-off, public, no-code job: any desktop PDF viewer can split and merge interactively; we did not test those, so treat that as orientation, not a benchmark.
- Confidential content: both libraries ran entirely on our local sandbox with zero uploads — the same privacy argument this site makes for in-browser conversion; an upload-based split service breaks that bar by design.
Quick FAQ
Does split order matter for text fidelity?
Not in our runs: split outputs carried the exact per-page text of their source pages. Split reorders pages, it does not rewrite them.
Why did the title vanish — is that normal?
In our test runs, yes: both libraries produced title-less merged output. Titles are document metadata, merges rebuild page trees, and inheritance is not automatic. The safe habit from this run: after any merge, set the title (and any other metadata you rely on) explicitly, then verify by reading it back.
Can I reproduce this?
Yes: build any 4-page PDF, run the same two libraries, and check three things per file — page count, one page of extracted text, and the metadata title after a merge. If your document has bookmarks or forms, expect our results to say nothing about them; test your own file.
Previous in the runs-from-real-files series: PDF to Markdown, three tools run and Markdown to PDF, four pipelines run. Bookmark pdf2mdtool.com and follow along.