Skip to content

condorheroblog/merge-pdfs

Repository files navigation

@condorhero/merge-pdfs

NPM version NPM Downloads GitHub stars LICENSE

Merging PDF (with Outline).

Node.js > 18.5.0.Technical support provided by pypdf.

motive

In the Javascript world, when merging multiple PDFs with outlines, the outline will be automatically lost. Neither pdf-lib nor pdfjs solve this problem, and even the PDFCPU that processes PDFs in the GO language world does not support this feature. The reason is that the outline and page are not within the same object of the PDF specification, making copying the outline more complex. However, this feature can be achieved, such as pypdf in the Python language world.

Installation

npm install -D @condorhero/merge-pdfs

Usage

# The default export file name is merged-pdf.pdf
merge-pdfs 1.pdf 2.pdf

# Customize to Export File Name
merge-pdfs 1.pdf 2.pdf -o custom.pdf

# glob: merge some pdf
merge-pdfs pdf/*.pdf -o merged-pdf.pdf

License

MIT