www.eamoncaddigan.net

Content and configuration for https://www.eamoncaddigan.net
git clone https://git.eamoncaddigan.net/www.eamoncaddigan.net.git
Log | Files | Refs | Submodules | README

commit 9d0c6200309f20e300b1d185d9b1518b01ebad26
parent a88af11beb70e13176f93ac017ec018f1281d1b0
Author: Eamon Caddigan <eamon.caddigan@gmail.com>
Date:   Mon, 21 Apr 2025 13:35:38 -0700

Introduce another useful postscript file for hole punches

Note to self (and anyone reading this):
PDFs are generated using `gs -o file.pdf -sDEVICE=pdfwrite -f file.ps`

Ghostscript is great but its command interface is funky!

Diffstat:
Mcontent/posts/postscript-graph-paper/index.md | 3++-
Acontent/posts/postscript-graph-paper/threehole.pdf | 0
Acontent/posts/postscript-graph-paper/threehole.ps | 45+++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/content/posts/postscript-graph-paper/index.md b/content/posts/postscript-graph-paper/index.md @@ -1,7 +1,7 @@ --- title: "PostScript Graph Paper" date: 2023-10-22T05:52:41-07:00 -lastmod: 2023-11-08T21:12:00-08:00 +lastmod: 2025-04-21T13:42:55-07:00 draft: false categories: - Programming @@ -16,6 +16,7 @@ the process was fun enough that I have since made a few different kinds: * [5 mm × 5 mm grid (pdf)](grid.pdf) ([postscript](grid.ps)) * [5 mm × 5 mm dot grid (pdf)](dotgrid.pdf) ([postscript](dotgrid.ps)) * [1 inch width hex grid (pdf)](hexgrid.pdf) ([postscript](hexgrid.ps)) +* [Three hole template with registration marks](threehole.pdf) ([postscript](threehole.ps)) These files are meant for US Letter paper but could easily be adapted to other dimensions. They are also "full bleed" because I decided to allow my diff --git a/content/posts/postscript-graph-paper/threehole.pdf b/content/posts/postscript-graph-paper/threehole.pdf Binary files differ. diff --git a/content/posts/postscript-graph-paper/threehole.ps b/content/posts/postscript-graph-paper/threehole.ps @@ -0,0 +1,45 @@ +%!PS +% Adjust these to suit your needs, units are specified in "points" (1/72 inch) +/w 612 def /h 792 def % US Letter paper +/st 1 72 mul 300 div def % Stroke width (1 'dots' in 300 dpi resolution) +/co 0.0 def % Grey-level of the line (0 = black, 1 = white) +/r 72 8 div def % Hole circle radius (1/4" diameter hers) +/l 72 5 div 2 mul def % Length of crosshair segment +/o l -2 div def % Crosshair offsets + +% Draw a circle with crosshairs (x y -- ) +/c { + 2 copy + moveto + o 0 rmoveto + l 0 rlineto + o o rmoveto + 0 l rlineto + stroke + newpath r 0 360 arc closepath stroke +} def + +% Draw three holes at the given x-offset (x -- ) +/d { + h 2 div % y offset of the center hole + 108 72 mul 25.4 div % distance from center hole (108 mm) + 3 copy add c % Top hole + 3 copy sub c % Bottom hole + pop c % Center hole +} def + +3 72 mul 8 div dup % Push the edge offset onto the stack (twice) + +% Draw the left hole punch page +<< /PageSize [w h] >> setpagedevice +co setgray +st setlinewidth +d +showpage + +% Draw the right hole punch page +<< /PageSize [w h] >> setpagedevice +co setgray +st setlinewidth +w exch sub d +showpage