Ruled paper laid out to the millimetre
Places every writing baseline in whole micrometres, shows where the first and last rules land, and creates a physically-sized SVG sheet with optional dashed, dotted and vertical guide lines.
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 |
How it works
What this works out
Ruled paper is a physical layout, not a repeating screen background. This tells you exactly where the first and last baselines sit on the trimmed sheet, how many fit, and how much horizontal rule is drawn. The downloaded vector is made from that same geometry, so the result panel and the page cannot disagree.
The method
The blank border is taken off both sides of the page. Vertically, the first baseline is placed after both the top border and the extra heading space. The remaining distance down to the bottom border is divided by the requested line spacing and rounded down; one is then added because two endpoints contain one interval, three endpoints contain two, and so on.
All of that happens in whole micrometres. A quarter inch is exactly 6.35 mm, or 6,350 micrometres, so each addition remains exact. The output converts back to millimetres only after every line has its final position.
Before you read on
There are exactly 36 quarter-inch gaps from the first permitted baseline to the last. How many horizontal rules are drawn?
37. A sequence with 36 intervals has 37 baselines: the first endpoint, one after each interval, and the final endpoint. The calculation therefore uses floor(available ÷ spacing) + 1 whenever the first rule fits.
A worked example
A4 portrait, 8 mm spacing, 12 mm blank edge, 20 mm heading space and a 0.2 mm solid rule:
page 210 x 297 mm
first baseline 12 + 20 = 32 mm from the top
bottom boundary 297 - 12 = 285 mm
complete intervals floor((285 - 32) / 8) = 31
writing lines 31 + 1 = 32
last baseline 32 + 31 x 8 = 280 mm
rule width 210 - 24 = 186 mm
total horizontal ink 32 x 186 = 5.952 m of rule
The final 5 mm between the last baseline and the bottom boundary is a remainder, not enough for another 8 mm interval. Those figures are asserted in the formula tests and reproduced in the first intent page.
US Letter with a half-inch margin, one inch of heading space and quarter-inch ruling is the exact imperial example. The first baseline is 1.5 inches from the top, 36 complete quarter-inch intervals reach the 10.5-inch bottom boundary, and therefore 37 rules are drawn.
Printing the sheet
The SVG uses real millimetres and vector paths, but a print dialogue is allowed to ignore that intent. Choose 100% or Actual size and turn off Fit to page. A ruler across ten intervals gives the quickest check: 8 mm ruling should measure 80 mm from the first baseline to the eleventh, and quarter-inch ruling should measure exactly 2.5 inches over the same ten intervals.
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
What does line spacing measure on ruled paper?
It is the baseline-to-baseline distance between adjacent horizontal rules. It is not the blank gap between their visible stroke edges, which becomes slightly smaller when a heavier rule weight is selected.
Why does the page use micrometres internally?
The number of lines depends on rounding down a division. Converting each accepted millimetre value to a whole micrometre makes quarter-inch and decimal spacing exact at that boundary instead of nearly exact in binary.
Can an SVG really have a paper size?
Yes. Its root declares width and height in millimetres as well as a matching view box. A print application that honours those physical units can place the vector geometry at the requested scale.
Why is the red guide moved when I put it inside the edge margin?
A guide outside the horizontal rules would sit in the deliberately blank border and might be clipped by the printer. It is therefore clamped to the first or last writable x-coordinate.