In this article, I will show you how to merge pdf files in Node.js application for linux system. Since many times we need to play with pdf files while web app development. With nodejs this task can easily be performed. With Node.js we will use Ghostscript, multiple PDF files can be merged into single PDF files.
type below command over terminal to install Ghostscript
sudo apt-get install Ghostscript
After running the above command Ghostscript will be installed in your system. Now with below Ghostscript command multiple PDF files can be merged into single PDF file.
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=new-merged.pdf -dBATCH first.pdf second.pdf
In the above command, we are merging a new file from two different file named first.pdf and second.pdf
Let's have a look how we will use Ghostscript in our nodejs code. See the nodejs code below:
So in this article, We learn how to merge pdf files in nodejs application.
That’s all for now. Thank you for reading and I hope this artible will be very helpful to understand how to merge pdf files in nodejs application .
Let me know your thoughts over the email demo.jsonworld@gmail.com. I would love to hear them and If you like this article, share with your friends.