Skip to content
Merge multiple PDF Files into a single PDF document
Branch: master
Clone or download
Latest commit c72cf07 May 23, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
test Fixed wildcard tests May 24, 2019
.gitignore v1.0.0 Jul 19, 2017 update README Jan 14, 2019
index.js Fixed wildcard tests May 24, 2019
package-lock.json 1.2.0 Jan 14, 2019
package.json 1.2.0 Jan 14, 2019


Merge multiple PDF Files into a single PDF document supporting three output formats: Buffer, Stream, New file on disk.


PDFMerge uses PDFtk to merge the documents and as such it is a requirement in order for PDFMerge to work. It will work on any platform supported by PDFtk. Starting from v1.0.0 a requirement of Node >= 4.0.0 is required as well. If you are stuck in the dark ages then npm i pdf-merge@0.1.1 should still work.

Installing PDFtk


Download and run the Installer.

Debian, Ubuntu

apt-get install pdftk



PDFMerge(files, options)

files is expected to be an array of files (must be full path for each respective file) or objects.

The file object have the follow options:

  • file Full path of PDF file
  • inputPw Password to decrypt a PDF Optional!


  • libPath Should only be provided if pdftk is not in your PATH Optional!
  • output Defaults to Buffer. Values Buffer, Stream, and path to a new file are accepted. Optional!
  • execOptions This is an optional string where you can pass additional argument to pdftk, for example compress. For the complete list see the docu of the pdftk


const PDFMerge = require('pdf-merge');

const files = [
	{file: `${__dirname}/protected.pdf`, inputPw: '_SeCrEt_'}

//Buffer (Default)
.then((buffer) => {...});

PDFMerge(files, {output: 'Stream'})
.then((stream) => {...});

//Save as new file
PDFMerge(files, {output: `${__dirname}/3.pdf`})
.then((buffer) => {...});
You can’t perform that action at this time.