8 mm ruled lines on A4 paper
With a 12 mm margin and 20 mm of extra space above the first rule, portrait A4 takes 32 horizontal writing lines at 8 mm spacing. The first rule is 32 mm from the top edge and the last is 280 mm down, leaving 17 mm to the trimmed bottom edge.
The ruled sheet
A complete SVG dimensioned in millimetres. Print at 100% or Actual size to keep the selected spacing.
Every horizontal rule
| 1 | 32 | 12 | 198 |
| 2 | 40 | 12 | 198 |
| 3 | 48 | 12 | 198 |
| 4 | 56 | 12 | 198 |
| 5 | 64 | 12 | 198 |
| 6 | 72 | 12 | 198 |
| 7 | 80 | 12 | 198 |
| 8 | 88 | 12 | 198 |
| 9 | 96 | 12 | 198 |
| 10 | 104 | 12 | 198 |
| 11 | 112 | 12 | 198 |
| 12 | 120 | 12 | 198 |
| 13 | 128 | 12 | 198 |
| 14 | 136 | 12 | 198 |
| 15 | 144 | 12 | 198 |
| 16 | 152 | 12 | 198 |
| 17 | 160 | 12 | 198 |
| 18 | 168 | 12 | 198 |
| 19 | 176 | 12 | 198 |
| 20 | 184 | 12 | 198 |
Each horizontal rule is 186 mm long between the two 12 mm side margins.
Thirty-two rules contain 5.952 metres of horizontal line in total.
The downloaded SVG declares its page size in millimetres rather than screen pixels.
How it works
The formula
firstLine = edgeMargin + headingSpace
bottom = pageHeight - edgeMargin
if firstLine <= bottom:
writingLines = floor((bottom - firstLine) / spacing) + 1
lineY[n] = firstLine + n x spacing
otherwise:
writingLines = 0
ruledWidth = pageWidth - 2 x edgeMargin
totalRuleLength = writingLines x ruledWidth
Every length is held as an integer number of micrometres, then written to
an SVG whose width and height are declared in millimetres.
What it assumes
- Paper dimensions are trimmed physical sizes. The printer's hardware margin is not deducted; a requested line can still be clipped by a device that cannot reach it.
- The first rule is the edge margin plus the extra heading space. Heading space does not replace the blank edge margin.
- A line exactly on the bottom boundary is included, which is why a sheet can have one more rule than it has spacing intervals.
- The vertical guide is measured from the paper edge and clamped inside the horizontal writing width. Zero omits it entirely.
- Physical size is preserved only when the print dialogue uses 100% or Actual size. Fit-to-page deliberately rescales the sheet.
Common questions
Why is the first line 32 mm from the top instead of 20 mm?
The 20 mm heading space is added below the 12 mm edge margin. Their sum places the first writing baseline 32 mm from the physical top edge.
Will the lines stay 8 mm apart when printed?
Yes if the print scale is 100% or Actual size. Fit-to-page scaling deliberately shrinks the entire SVG and therefore the line spacing too.
Sources
The full method, worked example and every assumption behind this figure are on Printable Ruled Paper Maker.