%!PS-Adobe-3.0 %%BoundingBox: 0 0 612 792 /mm { 25.4 div 72 mul } def /inch { 72 mul } def % Margin at around the pages (typically to accomodate printer constraints) /margin 12 mm def % Edit here if there should be a footer. It is right aligned at the bottom % of the page. Just use () for empty text. /footer-text (Noisebridge) def /footer-size 6 def % Letter size /page-width 11.0 inch margin 2 mul sub def /page-height 8.5 inch margin 2 mul sub def % A4 Size %/page-width 297 mm margin 2 mul sub def %/page-height 210 mm inch margin 2 mul sub def /default-font /Helvetica findfont def % Given a \n separated string, determine the longest with the current font % (string) -> <#lines> /longest-line { /ll-lines 0 def /ll-longest 0 def { (\n) search exch % want to look at current string first stringwidth pop dup ll-longest gt { /ll-longest exch def } { pop } ifelse /ll-lines ll-lines 1 add def not { exit } if % if this was the last one: exit loop pop % remove \n } loop ll-lines ll-longest } def /footer { default-font footer-size scalefont setfont % Make footer text right-aligned footer-text stringwidth pop page-width exch sub page-height 2 div neg moveto footer-text show } def % /show-max { gsave % Go to center of page and print landscape page-height 2 div margin add 0 translate 90 rotate % Test how font would look like with 50 pt. default-font 50.0 scalefont setfont dup % we need the string later longest-line % num size % Now scale the font-size proportionally that it fits in page-width. page-width exch div 50.0 mul /sm-font-size exch def /sm-line-count exch def % Now let's see if all lines fit onto the page vertically. % If not, let's adjust sm-line-count sm-font-size mul page-height gt { /sm-font-size page-height sm-line-count sm-font-size mul div sm-font-size mul def } if % Alright, we got our proper font-size, set it. default-font sm-font-size scalefont setfont % Now just print, newlines separated by \n margin sm-font-size sm-line-count mul 2 div sm-font-size 1.2 div sub moveto { (\n) search exch % want to look at current string first show not { exit } if % if this was the last one: exit loop pop % remove \n currentpoint exch pop sm-font-size sub margin exch moveto } loop footer showpage grestore } def %-- From here, just create new pages --- % Simple: create the %%Page: header, then a single line with the string % to be printed in parenthesis (with \n for newline), followed by show-max % Some samples below. %%Page: (Goggles\nGloves) show-max % this contains a newline \n %%Page: (Drills\nMills) show-max %%Page: (Screwdriver) show-max