Giter Site home page Giter Site logo

pdf-merger-js's Introduction

Description

This node.js library can merge multiple PDF documents, or parts of them, to one new PDF document. It's only dependency is pdfjs so it can run in any javascript-only environnement without any external dependencies.

This library is inspired by the PHP library PDFMerger and has a very similar API.

Installation

npm install --save pdf-merger-js

Code sample

const PDFMerger = require('pdf-merger-js');

var merger = new PDFMerger();

(async () => {
  merger.add('pdf1.pdf');  //merge all pages. parameter is the path to file and filename.
  merger.add('pdf2.pdf', [2]); // merge only page 2
  merger.add('pdf2.pdf', [1, 3]); // merge the pages 1 and 3
  merger.add('pdf2.pdf', '4, 7, 8'); // merge the pages 4, 7 and 8
  merger.add('pdf3.pdf', '1 to 2'); //merge pages 1 to 2
  merger.add('pdf3.pdf', '3-4'); //merge pages 3 to 4

  await merger.save('merged.pdf'); //save under given name and reset the internal document
})();

Similar libraries

pdf-merger-js's People

Contributors

dependabot[bot] avatar iudex- avatar johnkmzhou avatar mmyjona avatar mojoaxel avatar nbesli avatar nicolaselopez avatar rimashmohomed avatar severi avatar

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.