Tools
Blog
Sign InSign Up
Blog|Engineering

Browser-First PDF Manipulation: No Server Required

Modern browsers can merge, split, and compress PDFs entirely client-side using PDF.js and pdf-lib. We explain the technical approach behind PDF Forge.

July 25, 2026 7 min read

Why Server-Side PDF Processing Is a Problem


PDF manipulation is among the most privacy-sensitive operations a web user can perform. Merging legal contracts, splitting financial statements, compressing tax returns — these files contain some of the most personal data imaginable.


Yet nearly every popular PDF tool (Smallpdf, ILovePDF, PDF24) uploads your documents to European or American cloud servers, processes them there, and promises to delete them "within a few hours." You're trusting their word — and their security posture — with your most sensitive documents.


ElevenTools PDF Tools takes a fundamentally different approach. Your PDFs never leave your device.


The PDF Stack: pdf-lib + PDF.js


PDF Tools relies on two battle-tested open-source libraries:


  • **[pdf-lib](https://github.com/Hopding/pdf-lib)** — A TypeScript library for creating and modifying PDF documents, running entirely in the browser.
  • **[PDF.js](https://github.com/mozilla/pdf.js)** — Mozilla's PDF rendering engine, used for previewing pages before operations.

  • Merging PDFs


    import { PDFDocument } from 'pdf-lib';


    async function mergePDFs(files: File[]): Promise {

    const mergedPdf = await PDFDocument.create();


    for (const file of files) {

    const arrayBuffer = await file.arrayBuffer();

    const doc = await PDFDocument.load(arrayBuffer);

    const copiedPages = await mergedPdf.copyPages(doc, doc.getPageIndices());

    copiedPages.forEach(page => mergedPdf.addPage(page));

    }


    return mergedPdf.save();

    }


    This merges arbitrary numbers of PDFs in pure JavaScript. Memory usage scales with the total size of input documents, which is why PDF Tools enforces a 50MB combined limit on the free tier.


    Splitting PDFs


    async function splitPDF(file: File, ranges: [number, number][]): Promise {

    const arrayBuffer = await file.arrayBuffer();

    const srcDoc = await PDFDocument.load(arrayBuffer);


    return Promise.all(ranges.map(async ([start, end]) => {

    const newDoc = await PDFDocument.create();

    const pages = await newDoc.copyPages(srcDoc,

    Array.from({ length: end - start + 1 }, (_, i) => start + i - 1)

    );

    pages.forEach(p => newDoc.addPage(p));

    return newDoc.save();

    }));

    }


    Compression via Re-encoding


    True PDF compression (removing embedded fonts, optimizing streams) is complex. PDF Tools currently offers "compression" by re-saving with pdf-lib's optimization flags, which removes redundant metadata and can reduce file size by 10–40% depending on the source document.


    The Privacy Guarantee


    PDF Tools is built on an inviolable constraint: the server never sees your files. This isn't just aspirational — Cloudflare Workers, our edge runtime, has no upload endpoints for PDF Tools. The architecture enforces privacy.


    Try PDF Tools at /pdf-tools.

    Share: