Last active
March 9, 2025 07:52
-
-
Save kenotron/16daa06c948943649b85be518e7ae221 to your computer and use it in GitHub Desktop.
ghostscript to deal with 3 hole punch margins
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/sh | |
gs \ | |
-o output_duplex_ch6.pdf \ | |
-dFirstPage=643 \ | |
-dLastPage=726 \ | |
-sDEVICE=pdfwrite \ | |
-dBATCH \ | |
-dNOPAUSE \ | |
-dDEVICEWIDTHPOINTS=612 \ | |
-dDEVICEHEIGHTPOINTS=792 \ | |
-dFIXEDMEDIA \ | |
-c "<< | |
/CurrPageNum 1 def | |
/BeginPage { | |
/CurrPageNum CurrPageNum 1 add def | |
CurrPageNum 2 mod 1 eq { | |
0.88235 0.88235 scale | |
72 36 translate | |
} | |
{ | |
0.88235 0.88235 scale | |
0 36 translate | |
} ifelse | |
} bind >> setpagedevice" \ | |
-f input.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/sh | |
gs \ | |
-o output_single.pdf \ | |
-sDEVICE=pdfwrite \ | |
-dFIXEDMEDIA \ | |
-dDEVICEWIDTHPOINTS=612 \ | |
-dDEVICEHEIGHTPOINTS=792 \ | |
-c "<< /BeginPage{ | |
0.88235 0.88235 scale | |
72 36 translate | |
} >> setpagedevice" \ | |
-f input.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment