induwara.lk
induwara.lkDocuments · Privacy-first

Merge PDF Files

Combine multiple PDFs into one document — fully inside your browser, no signup, no upload. Drag to reorder, preview each file, and download the merged result. Pages stay byte-identical to the originals; nothing is re-rasterised. Sources cited.

By Induwara AshinsanaUpdated May 11, 2026
PDF MergerIn-browser · no upload
Files stay on your device

Everything happens in your browser. Nothing is uploaded.

Will be saved as merged.pdf when you press Download.

PDFs queued
0
Expected pages
Add at least two PDFs
Input size
0 B
Output size
Press Merge to compute
Ready to merge

Add at least two PDFs to get started.

Built against the ISO 32000-2 PDF 2.0 specification, using pdf-lib for the page-tree assembly. PDF version + integrity checks verified 2026-05-11— full source list in the "Sources & references" section below.

How it works

A PDF file is, in spec terms, a body of numbered objects (pages, fonts, images, content streams) plus a cross-reference table that tells a reader the byte offset of each object. The page tree (ISO 32000-2 §7.7.3.2) is a shallow structure: a root /Pages dictionary points to /Kids (each a /Page object), and the catalog points to that root. To merge two PDFs you copy every page object from each source — together with everything it references (resources, fonts, images, content streams) — into a fresh document and rebuild a single page-tree root over the lot. That is what this tool does.

The merge is performed by pdf-lib, an MIT-licensed pure-JavaScript PDF library. It is loaded dynamically when you press Merge — until then the page bundle stays small and your browser does not download the ~270 KB library. Inside the React component the flow is straight: PDFDocument.create() for the destination, PDFDocument.load(bytes) for each source, then copyPages(src, indices).addPage(...) for every page, and finally save() to serialise.

For each PDF the tool does five deterministic things before the merge:

  1. Validate the file. Confirms the PDF type, a non-zero size, and a per-file cap of 100.0 MB. The first 1 KB is scanned for the literal %PDF-n.m header (ISO 32000-2 §7.5.2), and the last 2 KB for the %%EOF terminator (§7.5.5). Files missing either are rejected with an explanation.
  2. Read the version. The two ASCII digits inside the header give the PDF version (1.4 through 2.0 in real-world files). The version is shown on each queued row so you can spot a 2.0 file mixed with a 1.4 file before pressing Merge.
  3. Estimate page count. A heuristic byte-stream scan counts occurrences of /Type /Page (excluding /Pages). This is fast and accurate on every uncompressed PDF and on most modern PDFs. PDFs that store every page object inside a compressed object stream (ISO 32000-2 §7.5.8) under-count here — the exact count is reported after the merge.
  4. Order the queue. Files are merged in the order shown. Use the up and down arrows to nudge a file, or the trash icon to drop it. The page order in the output PDF mirrors the queue exactly.
  5. Merge and serialise. On Merge, pdf-lib creates a destination document, copies every page from each source (preserving the original byte streams), assigns them to the new page tree, writes a fresh catalog and trailer, and returns the merged byte buffer. That buffer is wrapped in a Blob and offered to you as a download via an object URL. No bytes leave the browser tab.

Worked examples

Two-chapter thesis stitch

A 24-page chapter draft (PDF 1.7 from LaTeX) merged with an 11-page reference list (PDF 1.4 from LibreOffice). Pages stay in upload order; the resulting catalog has 35 entries.

  1. Inputs: PDF 1.7 (24 pages) + PDF 1.4 (11 pages)
  2. Sum of page counts: 24 + 11 = 35
  3. Merged document: 35 pages, ordering preserved
  4. Output ≈ sum of inputs minus one duplicated catalog header (~2 KB).

Five scanned receipts

Five single-page receipts from a phone scanner app (PDF 1.5, JPEG-backed pages). The merger preserves the JPEG image streams byte-for-byte — there is no re-rasterisation.

  1. Inputs: PDF 1.5 (1 page) + PDF 1.5 (1 page) + PDF 1.5 (1 page) + PDF 1.5 (1 page) + PDF 1.5 (1 page)
  2. Sum of page counts: 1 + 1 + 1 + 1 + 1 = 5
  3. Merged document: 5 pages, ordering preserved
  4. Output ≈ sum of inputs; image streams are copied without re-encoding.

Mixed-version compliance pack

Three policy documents at differing PDF versions (2.0 from a recent Word, 1.7 from Acrobat, 1.4 from an older scanner). pdf-lib normalises to PDF 1.7 on output.

  1. Inputs: PDF 2.0 (12 pages) + PDF 1.7 (8 pages) + PDF 1.4 (4 pages)
  2. Sum of page counts: 12 + 8 + 4 = 24
  3. Merged document: 24 pages, ordering preserved
  4. Output PDF version: 1.7 (pdf-lib's default). Page count exact, ordering preserved.

Frequently asked questions

Sources & references

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.