Skip to content

Instantly share code, notes, and snippets.

@zelinskiy
Last active January 27, 2020 12:21
Show Gist options
  • Save zelinskiy/ff6de9ca315c76c999a12f9b1e8d37d2 to your computer and use it in GitHub Desktop.
Save zelinskiy/ff6de9ca315c76c999a12f9b1e8d37d2 to your computer and use it in GitHub Desktop.
<< front >>
13 12
4 5
1 8
16 9
back
11 14
6 3
7 2
10 15
# requirements: qpdf, psutils
# input.pdf must be a multiple of 16
N=$(qpdf --show-npages input.pdf)
I=1
I=$((I+16))
while $I < $N
qpdf --empty --pages input.pdf $I-$((I+15)) -- input$I.ps
pstops -pa4 '16:12L@0.36(0.5w,0.75h)+3L@0.36(0.5w,0.5h)+0L@0.36(0.5w,0.25h)+15L@0.36(0.5w,0)+11R@0.36(0.5w,1.0h)+4R@0.36(0.5w,0.75h)+7R@0.36(0.5w,0.5h)+8R@0.36(0.5w,0.25h),10L@0.36(0.5w,0.75h)+5L@0.36(0.5w,0.5h)+6L@0.36(0.5w,0.25h)+9L@0.36(0.5w,0)+13R@0.36(0.5w,1.0h)+2R@0.36(0.5w,0.75h)+1R@0.36(0.5w,0.5h)+14R@0.36(0.5w,0.25h)' input$I.ps output$I.ps
P1 (S1 front)
29 28
4 5
1 8
32 25
P2 (S1 back)
27 30
6 3
7 2
26 31
P3 (S2 front)
17 24
16 9
13 12
20 21
P4 (S2 back)
23 18
10 15
11 14
22 19
pstops -pa4 '32:28L@0.36(0.5w,0.75h)+3L@0.36(0.5w,0.5h)+0L@0.36(0.5w,0.25h)+31L@0.36(0.5w,0)+27R@0.36(0.5w,1.0h)+4R@0.36(0.5w,0.75h)+7R@0.36(0.5w,0.5h)+24R@0.36(0.5w,0.25h),26L@0.36(0.5w,0.75h)+5L@0.36(0.5w,0.5h)+6L@0.36(0.5w,0.25h)+25L@0.36(0.5w,0)+29R@0.36(0.5w,1.0h)+2R@0.36(0.5w,0.75h)+1R@0.36(0.5w,0.5h)+30R@0.36(0.5w,0.25h),16L@0.36(0.5w,0.75h)+15L@0.36(0.5w,0.5h)+12L@0.36(0.5w,0.25h)+19L@0.36(0.5w,0)+23R@0.36(0.5w,1.0h)+8R@0.36(0.5w,0.75h)+11R@0.36(0.5w,0.5h)+20R@0.36(0.5w,0.25h),22L@0.36(0.5w,0.75h)+9L@0.36(0.5w,0.5h)+10L@0.36(0.5w,0.25h)+21L@0.36(0.5w,0)+17R@0.36(0.5w,1.0h)+14R@0.36(0.5w,0.75h)+13R@0.36(0.5w,0.5h)+18R@0.36(0.5w,0.25h)' input.ps output.ps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment