Dairon Medina Caro

Dairon Medina Caro

Random ramblings about Software Engineering, Linux and other daemons


Join PDF files in linux

Hello linux users: in this post i will show how to join two or more PDF files into one. You have to install the Ghostscript driver to do that, typing in a terminal(is for Debian and Ubuntu):
apt-get install gs
apt-get install pdftk
Now we join the PDFs with this command:
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=unidos.pdf  file1.pdf  file2.pdf
Here is the explanation of command: gs: Call to the Ghostscript program. -dBATCH: Close the Ghostscript when terminate the process. -dNOPAUSE: Dont pause the program to aks for user interaction. -q: Dont show messages during the process. -sDEVICE=pdfwrite: Use Ghostscript PDF generator to do the process. -sOutputFile=unidos.pdf: The name of the result file. You can also join all PDF files in a directory typing *.pdf.