combine-multiple-pdfs

Merge multiple pdfs into a single pdf

Usage no npm install needed!

<script type="module">
  import combineMultiplePdfs from 'https://cdn.skypack.dev/combine-multiple-pdfs';
</script>

README

combine-multiple-pdfs

npm master branch Codecov branch

Combine or Merge multiple Pdfs into single a Pdf

Table of Contents

Why?

I needed a simple way to combine multiple pdf files into a single pdf file.

Installation

$ npm i combine-multiple-pdfs -S

Functions

Take a look into the usage section for a detailed example.

combinePdfs

Note: you can also use the default export.

This function Takes Array of file paths and converted into a sigle new buffer.

Syntax

Returns a new pdf file buffer.

const newBuffer = combinePdfs(data, options);
Parameters
  • data: an array of strings of files
  • options: a object (optional)
    • holds two keys: outName and outPath
    • outName: output file name (optional parameter)
    • outPath: output file path (optional parameter) default: data files path

Usage

An example how to use it.

const { combinePdfs } = require("combine-multiple-pdfs");
/* or */
const combinePdfs = require("combine-multiple-pdfs");

let data = ["./dummy.pdf", "./dummy1.pdf"];
/* Minimum two files required */

let options = { outName: "mergedPdf", outPath: "./public" };

let newFileBuffer = combinePdfs(data, options);