How to Merge Large PDFs Without Crashing Your Browser
You have three 80-page reports, each around 50 MB. You try to merge them on a free online tool and get "file too large" after uploading for two minutes. Or your browser tab crashes before the merge even starts.
This happens because most PDF merge tools either force you to upload to a server (slow, privacy risk) or try to load everything into memory at once (browser crashes).
Here is how we solved it at — a browser-based merger that handles large files without uploading anything.
The problem with large PDF merges
When you merge PDFs, the browser has to:
Load each file into memory
Extract every page
Copy pages into a new document
Save the result
For small files (under 10 MB each), this is fine. But for large scanned reports, a single PDF can be 100+ MB. Load three of those and your browser runs out of memory.
The second problem is upload time. Traditional tools send your files to a server first. A 150 MB upload on a slow connection takes forever, and you have no guarantee the server won't keep a copy.
Our approach: stream processing + memory limits
The key insight is that you don't need all files loaded at once. You can process them one at a time:
import { PDFDocument } from 'pdf-lib'
async function mergeLargePdfs(files) {
const merged = await PDFDocument.create()
for (const file of files) {
const bytes = await file.arrayBuffer()
const sourcePdf = await PDFDocument.load(bytes)
const pages = await merged.copyPages(sourcePdf, sourcePdf.getPageIndices())
pages.forEach(page => merged.addPage(page))
// Let the source PDF be garbage collected
// before moving to the next file
}
return await merged.save()
}After copying pages from each source PDF, we let the browser's garbage collector reclaim that file's memory before moving to the next one. This means a 150 MB merge only uses about 50 MB of peak memory — the size of the largest single file.
We also set a hard limit: 100 MB per file. Anything larger gets a warning before the user even starts.
When browser merging won't work
Even with streaming, there are limits:
Memory-intensive operations — watermarking, rotating, or compressing 50 large files in one batch will eventually overwhelm the browser
Scanned PDFs with embedded images — each page can be 5–10 MB, so a 100-page scanned report is half a gigabyte
Network-dependent tools — if a tool forces uploads, your experience depends on connection speed
For these cases, a desktop tool like is more reliable. It handles large files without crashing because it uses system memory, not browser memory.
Practical tips for merging large PDFs
Split before merging — If you have 50 files, split them into batches of 10 and merge each batch separately.
Compress first — A quick compress pass on individual files before merging can reduce total size significantly.
Close other tabs — Free up browser memory before starting a large merge.
Use a modern browser — Chrome and Edge handle memory better than older browsers. Firefox is also fine.
Don't merge what you don't need — Sometimes you only need specific chapters. Use the split tool to extract just those pages first.
Summary
Large PDF merging in the browser is possible if you process files one at a time and respect memory limits. Our does exactly that — no upload, no signup, no crashes on files under 100 MB each.
留言
張貼留言