pdf bookmaking
pdf_bookmaking.sh:#!/bin/bash RANGE_LOW= RANGE_HIGH= SIG= DOC_IN= DOC_OUT= STRING="" PAGE=$RANGE_LOW echo $RANGE_LOW - $RANGE_HIGH with Signature of $SIG ROUNDS=$((($RANGE_HIGH-$RANGE_LOW+$SIG)/$SIG)) SUB=$(($SIG/4)) echo $ROUNDS for R in $(seq $ROUNDS); do OFFS=$((($R-1)*$SIG+$RANGE_LOW-1)) for i in $(seq $SUB); do let t=2*i let tt=$SIG-$t+2+$OFFS && [[ $tt -le ${RANGE_HIGH} ]] && T1=A$tt || T1=B1 let tt=$t-1+$OFFS && [[ $tt -le ${RANGE_HIGH} ]] && T2=A$tt || T2=B1 let tt=$t+$OFFS && [[ $tt -le ${RANGE_HIGH} ]] && T3=A$tt || T3=B1 let tt=$SIG-$t+1+$OFFS && [[ $tt -le ${RANGE_HIGH} ]] && T4=A$tt || T4=B1 STRING=$STRING"$T1 $T2 $T3 $T4 " done done echo "Taking $ROUNDS Rounds, to get" echo $STRING # pdfnup --pages $STRING --paper a4paper --nup 2x1 --outfile "$DOC_OUT" "$DOC_IN pdftk A=${DOC_IN} B=~/bin/empty_letter.pdf cat $STRING output ${DOC_OUT}