PDF Merger

Merge multiple PDF files into one. Drag, drop, reorder, and download � everything runs in your browser.

How to Use

1

Upload your PDF files

Click 'Add Files' or drag multiple PDFs into the tool. Each file's page count is shown in the list.

2

Arrange the order

Drag and drop files in the list to set the final page sequence of the merged document.

3

Click Merge PDFs

pdf-lib combines all pages from all files into a single new PDF document in your browser.

4

Download the merged file

Save the combined PDF document containing all pages from all input files in your chosen order.

The Internal Architecture of PDF Merging: Object Graphs, Indirect References, and XREF Tables

Combining multiple independent PDF files into a single unified document is a mission-critical workflow across law firms, corporate mergers and acquisitions (M&A), academic research, and government filings. Under the hood, merging PDFs is not a simple byte concatenation; it requires parsing, re-indexing, and rebuilding the internal PDF Document Object Model.

The 4-Part Structural Anatomy of a PDF File

Every valid ISO 32000-1 compliant PDF document consists of four distinct structural layers:

  1. Header: Declares the PDF specification version (e.g., %PDF-1.7).
  2. Body (Indirect Objects): A directed acyclic graph containing all document components—the root catalog dictionary, pages tree (/Pages), page nodes (/Page), content streams, embedded font programs (TrueType, CIDFont), and raster images.
  3. Cross-Reference Table (XREF): A byte-offset lookup index that tells the PDF viewer where every indirect object lives in the binary file for random access.
  4. Trailer: Points to the byte offset of the root catalog dictionary and contains the document checksum/ID.

Resolving Indirect Object ID Collisions in pdf-lib

When merging Document A and Document B, both source files typically label their internal objects starting with 1 0 R, 2 0 R, 3 0 R. Simply appending the files would cause fatal object ID collisions, corrupting fonts and content streams.

Our client-side merging engine (powered by pdf-lib) performs automated graph normalization:

  • Traverses each source document's indirect object graph and assigns unique incremental object numbers.
  • Clones the underlying page descriptors (/MediaBox, /CropBox, /Resources, and /Contents).
  • Synthesizes a master /Pages node containing an integrated /Kids array linking every imported page in exact user-ordered sequence.
  • Computes a brand new byte-accurate xref table and trailer dictionary.

Zero-Trust Local Security for Proprietary Financial Documents

Merging confidential audit reports, bank loan applications, or executive contracts using third-party web tools creates extreme security vulnerabilities. ConvertWithMi runs all PDF manipulation algorithms inside your local browser memory via WebAssembly and JavaScript. Zero bytes are transmitted across the internet.

Real-World Examples & Use Cases

Contract and Legal Document Assembly

Legal professionals, paralegals, and contract managers routinely need to compile multi-document packages: combining a master services agreement with its schedules, exhibits, and addenda into one signed document package. HR departments assemble onboarding document packages by merging employment contracts, benefits enrollment forms, and policy acknowledgments into a single comprehensive file to send to new employees. Court filings and regulatory submissions often require all supporting documents to be combined into one PDF for electronic filing systems.

Report and Presentation Compilation

Business analysts and report authors create final deliverable documents by merging individually prepared sections — executive summary, data analysis, charts and graphs, and appendices — into one complete report PDF. Quarterly board decks are assembled from department contributions (finance, operations, sales, marketing) prepared separately and merged into the final board presentation. Academic papers with supplementary materials, figures, and appendices submitted to journals require all components merged into a single PDF submission file.

Invoice and Financial Record Archiving

Small business owners and accountants consolidate monthly or quarterly invoices, receipts, and expense reports into single archive files for tax preparation and audit readiness. Expense reports submitted to finance departments combine the summary sheet with individual receipt PDFs. Year-end tax document packages merge W-2s, 1099s, and deduction documentation into one organized PDF for accountants. Digital bookkeeping systems that use PDF archives benefit from clean, merged monthly document files rather than hundreds of individual receipt files.

Academic and Research Document Packages

Researchers submitting papers to academic journals typically need to provide supplementary materials, figure captions, and technical appendices as a single combined PDF alongside the main manuscript. Graduate students assembling thesis documents combine the main dissertation text with committee approval pages, abstract, bibliography, and appendices. Job application packages in academia require merging cover letters, CVs, teaching statements, research statements, and sample publications into one application PDF that hiring committees can review as a complete package.

How It Works

PDF merging with pdf-lib (JavaScript): Core process: 1. Load each source PDF as an ArrayBuffer via FileReader API 2. Parse with pdf-lib: PDFDocument.load(arrayBuffer) 3. Create a new empty document: PDFDocument.create() 4. Copy pages from each source: const copiedPages = await mergedDoc.copyPages(srcDoc, srcDoc.getPageIndices()); copiedPages.forEach(page => mergedDoc.addPage(page)); 5. Serialize: const mergedPdfBytes = await mergedDoc.save(); 6. Create download blob: const blob = new Blob([mergedPdfBytes], { type: 'application/pdf' }); Page copying preserves: - Page content streams (text, graphics, images) - Fonts embedded in source documents - Page dimensions and rotation - Embedded images and vector graphics Limitations: - Interactive form fields may not merge cleanly - Digital signatures are invalidated by merging - Some encrypted/protected PDFs may fail to load - Very large PDFs (100+ MB each) may exceed browser RAM limits

Frequently Asked Questions

Is there a limit on how many PDFs I can merge or how large they can be?▼
There is no software-imposed file count limit. The practical limit is your device's available RAM — the tool loads all PDFs into browser memory simultaneously. On a device with 8 GB RAM with other apps running, you can typically merge files totalling 500 MB to 1 GB. For production workflows merging very large documents regularly, server-side PDF tools or desktop software like Adobe Acrobat handles large files more reliably.
Will the merged PDF preserve all fonts, images, and formatting?▼
Yes, in most cases. pdf-lib copies page content streams including embedded fonts, images, and vector graphics. Text formatting, layouts, tables, and graphics are preserved. Exceptions include: interactive form fields (may lose interactivity), JavaScript in PDFs, digital signatures (invalidated by any modification), and some unusual font embedding schemes. For standard document PDFs, merged output is visually identical to the source pages.
Can I merge password-protected PDFs?▼
PDFs encrypted with a user password cannot be opened or merged without the password. Before merging, use the PDF Password Remover tool to create an unlocked copy, then use that copy in the merger. Owner-restricted PDFs (restricted from editing/printing but openable without a password) may or may not merge successfully depending on the restriction level and the pdf-lib version.
Are my PDFs uploaded to any server?▼
No. This tool uses pdf-lib, a pure JavaScript library that runs entirely in your browser. Your PDF files are read into browser memory, processed locally, and the merged output is downloaded directly to your device. No file data is transmitted over the network. This makes it safe for sensitive documents including contracts, financial records, medical documents, and legal files.
Can I specify which pages to include from each source PDF before merging?▼
The merger includes all pages from each uploaded file. To include only specific pages from a source document, first use the PDF Splitter tool to extract the desired pages into a new PDF, then merge those extracted PDFs. This two-step workflow gives you full control over which pages from each source document appear in the final merged file.

Related Tools

Explore other tools in this category.

Looking for something else?