Skip to content

Instantly share code, notes, and snippets.

@caiorss
Forked from fabienhinault/bulletins_anonym_1.ps
Created February 27, 2017 23:47
Show Gist options
  • Save caiorss/12b201c4456d49ba79482f65081a4970 to your computer and use it in GitHub Desktop.
Save caiorss/12b201c4456d49ba79482f65081a4970 to your computer and use it in GitHub Desktop.
postscript file for vote bulletins
%!PS
%%DocumentMedia: a4 595 842 80 () ()
/pageHeight 842 def
/pageWidth 595 def
<< /PageSize [pageWidth pageHeight] >> setpagedevice
/mm { 2.834645669 mul } def
/margin 10 mm def
% arg stack: y x_right x_left string
% prints the string at y, centered between x_left and x_right
/centerText {
dup /Text exch def
stringwidth pop 2 div /HalfWidth exch def
dup /Left exch def
sub 2 div
HalfWidth sub
Left add
exch
moveto
Text show
} def
/Courier findfont % load the font, for instance, Courier
0 dict copy begin % copy it to a new dictionary
/Encoding ISOLatin1Encoding def % replace encoding vector
/MyCourier /FontName def % replace font name
currentdict end
dup /FID undef % remove internal data
/MyCourier exch definefont pop % define the new font
/Helvetica findfont % load the font, for instance, Courier
0 dict copy begin % copy it to a new dictionary
/Encoding ISOLatin1Encoding def % replace encoding vector
/MyHelvetica /FontName def % replace font name
currentdict end
dup /FID undef % remove internal data
/MyHelvetica exch definefont pop % define the new font
% separation lines
/lineWidth pageWidth margin 2 mul sub def
newpath
margin pageHeight .25 mul moveto
lineWidth 0 rlineto
stroke
newpath
margin pageHeight 0.5 mul moveto
lineWidth 0 rlineto
stroke
newpath
margin pageHeight .75 mul moveto
lineWidth 0 rlineto
stroke
newpath
pageWidth 0.5 mul margin moveto
0 pageHeight margin 2 mul sub rlineto
stroke
/MyHelvetica findfont 20 scalefont setfont
/pageWidthHalf pageWidth 0.5 mul def
% names
newpath
pageHeight .125 mul 10 sub pageWidthHalf 0 (Aaaaaa AAAAAA aa AAAAAAA) centerText
newpath
pageHeight .125 mul 10 sub pageWidth pageWidthHalf (Aaaaaaaa Aaaaaaa) centerText
newpath
pageHeight .375 mul 10 sub pageWidthHalf 0 (Aaaaaaaaa AA AAAA) centerText
newpath
pageHeight .625 mul 10 sub pageWidthHalf 0 (Aaaaaa AAAAAA aa AAAAAAA) centerText
newpath
pageHeight .625 mul 10 sub pageWidth pageWidthHalf (Aaaaaaaa Aaaaaaa) centerText
newpath
pageHeight .875 mul 10 sub pageWidthHalf 0 (Aaaaaaaaa AA AAAA) centerText
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment