Skip to content

Instantly share code, notes, and snippets.

@jbosboom
Created August 30, 2020 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbosboom/d25571290789b68065dbb480fec654eb to your computer and use it in GitHub Desktop.
Save jbosboom/d25571290789b68065dbb480fec654eb to your computer and use it in GitHub Desktop.
Generates landscape ruled paper
#!/usr/bin/env python2
margin = 0.375
lineheight = (8.5 - 2*margin)/25
linewidth = 11 - 2*margin
midgutter = 11.0/2
ypts = [(margin, midgutter-(margin/2)), (midgutter+(margin/2), 11.0 - margin)]
color = '#A4DDED'
thickness = 1.0/64
print '<svg width="11in" height="8.5in" xmlns="http://www.w3.org/2000/svg">'
for line in xrange(0, 26):
x = margin + line*lineheight
for (ystart, yend) in ypts:
print '<line x1="{1}in" x2="{2}in" y1="{0}in" y2="{0}in" stroke-width="{3}in" stroke="{4}" stroke-opacity="0.5"/>'.format(x, ystart, yend, thickness, color)
print '</svg>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment