How we merge 500-page PDFs in the browser
A tour of our client-side pipeline: streaming parsing, memory budgets, and why there’s no server in the loop.
Most online PDF tools work the same way: you upload your file to their server, the server does the work, and you download the result. That architecture is simple for the developer and terrible for you: your document crosses the network, sits in a stranger’s temporary storage, and depends on their retention policy actually being honored. We built FernPDF on the opposite premise: the browser is now powerful enough to do the work itself.
A merge starts with parsing. Each source PDF is read into an ArrayBuffer with the File API (a purely local operation) and parsed into an object model: pages, fonts, images, and the cross-reference table that holds a PDF together. Parsing is lazy where possible; we don’t decode a 40 MB scanned image just to copy a reference to it.
Copying pages between documents is the heart of the merge. A PDF page is a tree of objects with shared resources: two pages might reference the same font descriptor or image XObject. The copier walks each page’s object graph, deduplicates shared resources, renumbers object references for the destination file, and appends the result. Done naively this explodes memory on large files; done carefully, a 500-page merge peaks well under the memory of a single browser tab playing YouTube.
Memory budgeting matters most on mobile. We process source files sequentially rather than holding them all decoded at once, release each source document’s buffers as soon as its pages are copied, and let the final serialization stream into a single output buffer. The practical ceiling is your device’s RAM. A mid-range laptop comfortably merges documents that many upload-based services reject outright.
The payoff is structural, not just philosophical. There is no upload time, so a big merge starts instantly. There is no server queue, so it never slows down at month-end when everyone is processing invoices. And there is no copy of your document anywhere to leak, subpoena, or train a model on. Open your network tab while merging: the absence of traffic is the whole product.
Try it yourself. Every FernPDF tool runs in your browser. Open one and watch the network tab.
Open Merge PDF