OnlineTextLab
Esc

What Happens When You Merge PDFs, and What Gets Lost

Updated 6 min read How we check our guides

Merging combines pages, and pages are only part of a PDF. Text, images and page appearance come across safely in nearly every tool. Bookmarks, form behaviour, signatures, accessibility tags and internal links are stored partly or wholly outside the pages, and whether they survive depends on the tool.

For a stack of contracts or reports you only need to read, this does not matter. Merge away. For anything with fillable fields, a navigation tree or a signature, read on before you send the result.

How a PDF is put together

A PDF has a document catalog, which is the root of everything, and a page tree hanging off it. Each page object points to its own content: the drawing instructions, fonts and images it uses, and its annotations (links and form widgets count as annotations).

Everything else that applies to the whole document sits in the catalog, alongside the page tree. That includes:

  • Outlines, which are the bookmarks panel.
  • AcroForm, the document-wide list of form fields.
  • Named destinations, labels that links can jump to.
  • StructTreeRoot, the tag tree that screen readers use.
  • OCProperties, optional content layers.
  • PageLabels, such as “iv” or “A-3” numbering.

The simplest way to merge is to create a new document and copy page objects into it. That is why catalog-level features are the ones that vanish: nothing tells a page-copying tool to bring them along, and combining them correctly across files takes extra work.

What we saw in a real test

We built two matching three-page PDFs with reportlab. Each had three bookmarks, a link to the next page, a web link on every page, one text field named full_name with a different value, and the same JPEG image on each page. Each was about 304 KB. Then we merged them three ways and inspected the results with pikepdf.

FeatureOur Merge PDFPoppler pdfunite 26.04Ghostscript 10.04
All 6 pages presentYesYesYes
Web linksKeptKeptKept
Bookmarks (6 expected)006
Internal links land on a real pageNoNoYes
Form list in the catalogNone1 fieldNone
Form fieldsWidgets remain, no form listWidgets remain, second field not listedFlattened into page text
Copies of the shared image221
File size596,401 bytes607,762 bytes281,500 bytes

Three things are worth pulling out.

Internal links can quietly die. In the first two outputs, the link annotations were still present, but their destinations pointed to page objects that are not part of the merged page tree. A link that looks fine in the file does nothing useful when clicked. Links to websites have no such problem, since they carry a URL and need no page reference.

No tool here produced a working merged form. Ghostscript kept the appearance and turned the values into static content, which is often exactly what you want for an archive, but nothing can be edited afterwards. Our tool left the field widgets on the pages without the document’s form list, so treat those fields as not fillable. It also keeps full_name twice, which brings us to the next point.

Size is about the sum of the parts unless the tool removes duplicates. The two files shared an identical image, and only Ghostscript noticed. It rewrites the whole file rather than copying objects, which is why it can do this. It also means more chance of changes to images or colour, so check the output.

Why form fields collide

Every field in a PDF form has a name, and fields with the same full name are the same field by design. That is how a form repeats your name on page 5 after you type it on page 1. So merging two copies of one form, say for two different employees, creates a real conflict: type a name once and it may appear in both copies, or one set of values may overwrite the other.

The dependable approaches are:

  1. Flatten first if the data is final. Print to PDF or use a flatten option on each form, then merge. Values become part of the page and stop being fields.
  2. Rename fields in a PDF editor if the merged form must stay fillable.

Signatures do not survive

A digital signature covers the exact bytes of the original file. Copying its pages into a new document means the signed bytes no longer exist, so the signature cannot validate. At best, you end up with a picture of a signature. If a signed document has to go in a bundle, Acrobat’s PDF Portfolio or a plain ZIP keeps the original file untouched. We explain the difference between signature types in how to sign a PDF.

Other things that commonly change

  • Accessibility tags. A tagged PDF can lose its structure when pages are copied, leaving screen readers to guess reading order. If accessibility is a requirement, for instance in public sector work, use Acrobat and recheck with its accessibility tools.
  • Layers. Pages using optional content may show every layer, including ones meant to be hidden. Look closely at engineering drawings and maps.
  • Document title and author. The merged file gets new metadata, not a blend of the two. Our tool starts a fresh document, so the originals’ titles do not carry over. Set a title if the file is going somewhere public.
  • Page numbers. Numbers printed on pages stay as they are, so you can end up with 1, 2, 3, 1, 2, 3. PDF page labels may also reset. Our add page numbers tool can stamp a continuous sequence.
  • PDF/A status. Archival conformance is a promise about the whole file, and a merged result is not automatically conformant, even if every input was. Validate it again.
  • Page sizes. Letter and A4 pages sit happily side by side in one file. Viewers show them as they are, and printing can scale them inconsistently.

Passwords

Encrypted files need decrypting first, since their content cannot be read without the key. Our Merge tool refuses a password-protected file and tells you which one, rather than producing a corrupt result. If you know the password, remove it with the PDF Unlock Helper and merge the copy.

A quick way to decide

Your filesWhat to use
Plain documents to read or printAnything, including our Merge PDF
Bookmarks must surviveGhostscript or Adobe Acrobat
Chapters that link to each otherAcrobat, then click-test the links
Fillable forms that must stay fillableAcrobat, and check duplicate field names
Filled forms for the recordFlatten first, then merge with anything
Signed documentsDo not merge. Bundle them instead

The Ghostscript command we used is short:

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf a.pdf b.pdf

Check the result before sending

Merging fails quietly, so take two minutes. Count the pages against the sum of the inputs. Click one internal link and one bookmark, if there should be any. Search for a word from the last file, to confirm text is still text. Scroll through once, looking for rotated pages and strange margins.

If the merged file came out too large, compress it afterwards with Compress PDF, since its Lossless mode is safe for the features that remain. Merging inputs that are already small is still better, because it avoids a second round of image compression.