Skip to content

Instantly share code, notes, and snippets.

@dentarg
Created October 2, 2009 15:29
Show Gist options
  • Save dentarg/199822 to your computer and use it in GitHub Desktop.
Save dentarg/199822 to your computer and use it in GitHub Desktop.
Mergs PDF files using GhostScript
#!/bin/sh
if [ $# -eq 0 ]; then
echo 1>&2 Usage: $0 output.pdf source.pdf [source2.pdf ...]
exit 127
fi
for arg in $*
do
let "i += 1"
if [ $i -eq 1 ];
then
output=$arg
else
pdfs="$pdfs $arg"
fi
done
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$output $pdfs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment