Last active
November 18, 2019 11:15
-
-
Save mjm522/ae3a38f51b7083cf0047811862f6e000 to your computer and use it in GitHub Desktop.
Combining pdfs in Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this function to the `~/.bashrc` file or keep as a shell script file. | |
``` | |
function combine_pdfs() | |
{ | |
output_file=$1 | |
files=($2) | |
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dAutoRotatePages=/None -sOutputFile=$output_file "${files[@]}" | |
} | |
``` | |
Remember to source the file. Then in a terminal in the folder containing the files type: | |
Usage: combine_pdfs blah_blah.pdf 'first.pdf second.pdf third.pdf fourth.pdf' | |
The above script will create a file `blah.pdf` which is a combination of `first.pdf`, `second.pdf` and `third.pdf`. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add the this function to the
~/.bashrc
file or keep as a shell script file.Remember to source the file. Then in a terminal in the folder containing the files type:
Usage: combine_pdfs blah_blah.pdf 'first.pdf second.pdf third.pdf fourth.pdf'
The above script will create a file
blah.pdf
which is a combination offirst.pdf
,second.pdf
andthird.pdf
.