Created
December 8, 2015 02:32
-
-
Save pankaj28843/e6e8fc17ce080fe78cda to your computer and use it in GitHub Desktop.
This file contains hidden or 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
java -cp /opt/Multivalent.jar tool.pdf.Compress /tmp/5dd69f32-b97b-4f43-9bfa-f182e972f6ef.pdf | |
This file contains hidden or 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/bash | |
file=$1 | |
pages="`pdftk $file dump_data | grep NumberOfPages | cut -d : -f2`" | |
halfpages="`echo -n $(( $pages / 2 ))`" | |
width="$(pdfinfo $file | grep "Page size" | cut -d ':' -f2 | cut -d 'p' -f1 | cut -d 'x' -f1 | xargs)" | |
height="$(pdfinfo $file | grep "Page size" | cut -d ':' -f2 | cut -d 'p' -f1 | cut -d 'x' -f2 | xargs)" | |
doubleheight="$(echo $height*2 | bc)" | |
doublewidth="$(echo $width*2 | bc)" | |
sequence="`for ((x=$pages, y=1;x>=$halfpages, y<=$halfpages;x--, y++)); do echo "$x $y "; done | awk 'NR %2==1 {print $1, $2 } NR % 2==0 { print $2, $1, $2, $1 }' | xargs | tr " " ","`" | |
java -cp "/opt/Multivalent.jar" tool.pdf.Impose -verbose -dim 2x1 -paper "$doublewidth"x"$height"pt -layout "1,2" $file | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment