npm.io
1.0.2 • Published 7 years ago

pdfmerge

Licence
MIT
Version
1.0.2
Deps
0
Size
11 kB
Vulns
0
Weekly
0

PDFMergeJS

npm version

Merge PDF files into one.

What's new

  1. PDFMerge is now promise based.
  2. Better error handling.

Requirements

  1. Python 3 or above
  2. PyPDF2 >= 1.21
To install PyPDF2, run pip install PyPDF2>=1.21

Usage

  1. Install the module using npm install pdfmerge

  2. Require the module

    let PDFMerge = require('pdfmerge')
  3. PDFMerge(inputFiles, outputFile) - function

    • inputFiles - Array : An Array of all the input files
    • outputFile - String : String containing the output filename
  4. Example code:

    PDFMerge(['input-1.pdf', 'input-2.pdf'], 'output.pdf').then(function(done){
        console.log(done) // success
    }).catch(function(error){
        console.error(error.code) // Logs error code if an error occurs
    })

    error.code returns :

    • 404 - If any or all of the input files are not found
    • 1 - If PyPDF2 is not installed
Thanks to pdfmerge
MIT 2017-2019 Akash Rajendra

Keywords