Skip to content

Instantly share code, notes, and snippets.

@cypok
Created December 9, 2015 17:58
Show Gist options
  • Save cypok/cc2fc5b25b68ac6a9e37 to your computer and use it in GitHub Desktop.
Save cypok/cc2fc5b25b68ac6a9e37 to your computer and use it in GitHub Desktop.
Simple script to place two PDF pages on single page with separator
if [[ -z "$1" ]]; then
echo No input file
exit
fi
input=$1
middle=`mktemp -t pdf_2on1`.pdf
if [[ -z "$2" ]]; then
name="${input%.*}"
ext="${input##*.}"
output=${name}_2on1.$ext
else
output=$2
fi
pdfnup --frame true "$input" "$input" --outfile "$middle" 2>/dev/null
pdfjam --landscape --trim '1mm 1mm 1mm 1mm' --clip true "$middle" --outfile "$output" 2>/dev/null
rm "$middle"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment