PDF Merger
Merge multiple PDF files into one. Drag, drop, reorder, and download � everything runs in your browser.
How to Use
Upload your PDF files
Click 'Add Files' or drag multiple PDFs into the tool. Each file's page count is shown in the list.
Arrange the order
Drag and drop files in the list to set the final page sequence of the merged document.
Click Merge PDFs
pdf-lib combines all pages from all files into a single new PDF document in your browser.
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:
- Header: Declares the PDF specification version (e.g.,
%PDF-1.7). - 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. - 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.
- 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
/Pagesnode containing an integrated/Kidsarray linking every imported page in exact user-ordered sequence. - Computes a brand new byte-accurate
xreftable 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?▼
Will the merged PDF preserve all fonts, images, and formatting?▼
Can I merge password-protected PDFs?▼
Are my PDFs uploaded to any server?▼
Can I specify which pages to include from each source PDF before merging?▼
Related Tools
Explore other tools in this category.
Image to PDF
Convert JPG, PNG, and other images into a PDF. Choose page size, orientation, margins, and image fit.
PDF Metadata Viewer
Inspect any PDF file: view page count, dimensions, author, title, creation date and more � locally.
PDF Splitter
Extract specific pages from a PDF or split it into individual one-page files. Runs entirely in your browser.
PDF to Images
Convert each PDF page into a PNG or JPEG image.
PDF Password Remover
Remove password protection from your PDF files. Enter the known password and download an unlocked copy.
PDF to Text Extractor
Extract all raw text data from your PDF documents completely securely.