This script can be used to merge any two pdf files into one using JavaScript. Run merge.js and upload the pdf files which are to be merged and the ouput will be a single pdf file obtained by merging the uploaded pdfs.
- pdf-lib pdf-lib npm is a tool to modify exsisting pdfs using Node.js.
Install the module usingnpm install pdf-lib command. The module will be added to package.json
- Download or clone the repository.
- Install the requird module (pdf-lib).
- Run merge.js and add the pdfs which are to be merged.
- The merged pdf(named final_merged_pdf.pdf) will appear in the same directory.
The files I used hello.pdf and world.pdf have been added to the folder Merged_pdfs. Here's the ouput: