Giter Site home page Giter Site logo

pdf-merge's Introduction

PDFMerge

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

Requirements

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 [email protected] should still work.

Installing PDFtk

Windows

Download and run the Installer.

Debian, Ubuntu

apt-get install pdftk

RPM

https://www.pdflabs.com/docs/install-pdftk-on-redhat-or-centos/

Syntax

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!

options:

  • 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

Examples

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

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

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

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

//Save as new file
PDFMerge(files, {output: `${__dirname}/3.pdf`})
.then((buffer) => {...});

pdf-merge's People

Contributors

0x3333 avatar alromh87 avatar efernandesng avatar jamieslome avatar jluzz avatar kelvyne avatar kreozot avatar vicentenoriega avatar

Watchers

 avatar  avatar

Forkers

sharath-gitban

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.