Code Monkey home page Code Monkey logo

divyagupta167 / pdf-merger- Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 18 KB

This project provides a Node.js module for merging PDF files using the pdf-merger-js library. The module exports a function named mergePdfs, which takes two PDF files as input, merges them, and saves the merged PDF under a unique name in the public directory. The merged file is saved with a filename based on the current timestamp to ensure unique..

Home Page: https://divyagupta167.github.io/PDF-merger-/

JavaScript 17.80% HTML 82.20%

pdf-merger-'s Introduction

PDF Merger Using pdf-merger-js This repository contains a Node.js script that allows you to merge multiple PDF files into a single PDF using the pdf-merger-js library. The script provides a convenient way to merge entire PDFs or specific pages from different PDF files.

Getting Started Clone this repository to your local machine. Install the required dependencies by running npm install or yarn install. Prerequisites To use this script, you need to have Node.js installed on your machine.

How to Use The main functionality is implemented in the mergePdfs function, which is exported from the pdfMerger.js file. The function takes two PDF file paths as input and merges them into a new PDF file.

Here's how to use the script:

Make sure you have the PDF files you want to merge available on your machine. Require the mergePdfs function in your code and call it with the file paths as arguments.

Functionality The mergePdfs function uses the pdf-merger-js library to merge the PDFs. It provides flexibility to choose whether to merge the entire PDFs or specific pages. The following functionalities are available:

Merge the entire PDFs: Pass the file paths of the PDFs you want to merge, and it will combine all the pages from both PDFs into a new PDF file.

Merge specific pages from a PDF: You can also merge only specific pages from a PDF by providing the desired page numbers or ranges when calling the merger.add() method. However, for the current implementation, only merging the entire PDFs and merging the second page of the second PDF are demonstrated in the provided code.

Saving the Merged PDF The merged PDF is saved in the public directory with a filename based on the current timestamp. The PDF file will be named as .pdf.

Notes The script is designed to run on Node.js and is not intended for browser use.

pdf-merger-'s People

Contributors

divyagupta167 avatar

Watchers

 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.