What pdf-lib Does When You Click Merge
PDFBucket's PDF Merger uses pdf-lib (v1.17+) โ a pure-JavaScript library that manipulates PDF binary structures directly in your browser's memory.A PDF file is structured as a collection of objects indexed by a cross-reference table. Page content, fonts, images, and annotations are all individual objects referenced from a page tree. When pdf-lib merges two documents, it:
- Parses each PDF's cross-reference table to locate all page objects
- Copies each source page's content stream and resource dictionary into a new PDFDocument object
- Resolves resource naming conflicts (if both PDFs use a font named "F1", one gets renamed)
- Rebuilds the cross-reference table for the merged output
- Serializes the complete document to a Uint8Array and triggers a browser download
When Cloud PDF Mergers Are a Bad Idea
For non-sensitive documents, cloud tools are fine. But many PDF merges involve documents you would not want on someone else's server:- Tax returns and financial statements
- Job application packages (resume plus certificates plus ID proof)
- Medical reports
- Client contracts and NDAs
- Property documents
Common Merge Problems and How to Avoid Them
Password-protected PDFs: pdf-lib can merge PDFs with permission restrictions but cannot decrypt PDFs that require a password to open. Remove the open password first, then merge.Overlapping form field names: If two PDFs contain interactive forms with the same field name, the merged PDF will link them. If you are merging form-containing PDFs, flatten the forms before merging.
Very large files: pdf-lib holds the entire document in browser memory. Merging 10 x 50-page PDFs is fine on most desktop machines. On phones or low-RAM devices, keep total merge size under 200 MB.