Merging several PDF-files into one PDF
file; In Linux, you don't have to install any additional software to do
this. Everything can be done on the command line with a few simple lines
of code. If you however don't like to work on the command line, you
might want to install additional software (example: PDF-mod)
To make your life easier, I recommend
creating an alias for the PDF merge function. You do that by adding the
following code to your .bashrc file in the home folder.
At terminal prompt, type: gedit ~/.bashrc
and add the following to the text:
and add the following to the text:
# -------------------------------------------------
# provide PDF merge function with default -
# installed code on your system via command-line -
# -------------------------------------------------
mergepdf() { gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=mergedPDF_`date +'%F_%Hh%M'`.pdf -f "$@" ;}
# provide PDF merge function with default -
# installed code on your system via command-line -
# -------------------------------------------------
mergepdf() { gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=mergedPDF_`date +'%F_%Hh%M'`.pdf -f "$@" ;}
This will add create an alias with name mergepdf. To merge 2 or more PDF files into one PDF file you use the alias as follows:
mergepdf '~/Documents/file_1.pdf' '~/Documents/file_2.pdf' ... '~/Documents/file_x.pdf'
This will merge all the files into the result file named:
mergedPDF_<DATE>.pdf
NOTE: The first time after creating the alias in the .bashrc file, you will need to close the active terminal session, and re-open a new one.
No comments:
Post a Comment
Please be courteous, even if you do not share the same view.