Created
August 19, 2024 12:37
-
-
Save knee-cola/d29924031313afb5dee099d96ce83e23 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# Merges multiple PDF files into a single PDF file | |
# | |
# pdfmerge.sh [input-1.pdf] [input-2.pdf] [output.pdf] | |
# | |
# Example: pdfmerge.sh input-1.pdf input-2.pdf output.pdf | |
# | |
# written by: Knee-cola | |
# | |
# The trick: ghostscript (gs) will do PDF merging for you, it's just not | |
# obvious and the required defines are not listed in the manual page. | |
if [ $# -lt 3 ] | |
then | |
echo "Usage: pdfmerge.sh input-1.pdf input-2.pdf output.pdf" | |
exit 1 | |
fi | |
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE="$3" -dBATCH "$1" "$2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment