How to merge and split PDFs safely offline
By Felix Stiffel · · 5 min read
Why offline matters for merging and splitting
Merging and splitting are the most common things people do with PDFs: put the signed contract and its annexes into one file, send only the pages of a report that matter, pull a single payslip out of a yearly bundle. The files involved are often exactly the ones you would not want to hand to a stranger.
Many online PDF services upload your files, process them on a server and send the result back. That can be fine, but it means your documents spend some time on a computer you do not control, under a privacy policy you probably did not read. Merging and splitting do not need a server at all. Both are simple operations on the structure of the file, and a modern browser can do them on your own device. In our tests a merge took less than a second.
Test 1: does it work without a connection?
The most convincing check is to take the network away. We opened our Merge PDF tool in Chromium, waited until the page had loaded, and then switched the browser to offline mode. With the connection gone, we added two files, our 20-page sample report and a one-page table, and merged them.
The merge completed in 0.6 seconds and the downloaded file had all 21 pages. While we worked, the page made 4 network requests. All 4 were GET requests for the tool's own program code, and none carried any data. No request contained the PDFs.
You can repeat this test yourself on any tool that claims to work in your browser. Load the page, turn on flight mode or unplug the network, and run the tool. If it still produces a result, the work is done on your device. If it fails, it needs a server, and the server needs your file.
For a closer look, open your browser's developer tools before you start (F12, or Cmd+Option+I on a Mac), switch to the Network tab and watch it while the tool runs. A request that is as large as your file, or that sends it as form data, is an upload.
Test 2: how fast is it?
Merging in the browser does not mean waiting. In a test run of the merge function that the tool uses, combining 10 copies of the 20-page report into one 200-page file took 91 milliseconds and produced a 289 KB file.
We did not time splitting separately; it uses the same page-copying step as merging. Whatever the file size, there is no upload or download time on top, because the file never leaves your device.
What merging changes in your file
A merge tool takes the pages of several documents and puts them into a new document. The pages themselves come through intact: text, images and embedded fonts. But some things belong to the document as a whole rather than to its pages, and those are easy to lose.
Bookmarks. Our sample report had 10 bookmarks, one per chapter. After merging with our tool, the result had none. If your readers navigate long files by bookmarks, you will have to add them again in a PDF editor, or merge in the application that created the documents.
Form fields. We merged a simple PDF form with one text field with a copy of itself. The merged file still showed both field boxes on its pages, but a check with the pypdf library found 0 registered form fields, against 1 in the original. Fill in forms before you merge them, or keep them as separate files.
Accessibility tags and PDF/A. Our sample report was tagged for screen readers, and we also tested a PDF/A version. After merging, neither the tags nor the PDF/A marking were left. If a document must stay accessible or archivable, merge it in the original application or check the result with a validator.
Document properties. The title and author of the inputs are not carried over to the merged file. Usually that is a good thing for privacy, but set them again if you need them.
What splitting changes
Splitting has one surprise: the parts together are larger than the whole. We split the 20-page report, 49,923 bytes in total, into single pages. Each of the 20 files was between 15 and 16 KB, and together they came to 314,193 bytes, more than six times the original.
The reason is fonts. The original stores each font once and uses it on every page. Each single-page file needs its own copy of the fonts it uses, so the same font data is stored 20 times. Split into two 10-page parts instead, the two files were 22 KB each, which is much closer to the original.
So if you split to make files small enough for an email, split into a few larger parts rather than into single pages. If you only need some pages, extract just those pages into one file.
The same document-wide information is lost as when merging: the single-page files in our test had no bookmarks, no tags and no title or author.
A safe routine for sensitive files
1. Work on copies. Merging and splitting create new files, but it is easy to overwrite an original by saving under the same name.
2. Check the page order and the page count of the result before you send it. A merged file with a missing annex or a split file with one page too many is the most common mistake.
3. Name the output clearly. Merged and split files often end up with generic names; a name that says what is inside avoids sending the wrong file.
4. Look at the result as the recipient will. Open it in a different viewer, scroll through it, and check that forms, links and bookmarks you rely on still work.
5. Delete what you no longer need. Downloads folders fill up with intermediate files that contain the same sensitive pages as the originals.
Doing all of this on your own device removes one risk entirely: nobody else ever receives a copy of the files along the way.