Menu

Search toolsChangelog

to move to openDescribe the problem, not the tool

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.

Trimmed sizes from CSS Paged Media. An international inch is exactly 25.4 millimetres.

Measured baseline to baseline. Quarter-inch ruling is 6.35 mm.

Blank border at every edge. Your printer may impose a larger hardware margin.

Added below the top edge margin for a heading, name or binding.

Writing lines
32
First line from top edge (mm)
32.000
Last line from top edge (mm)
280.000
Length of each rule (mm)
186.000
Horizontal rule length (m)
5.952
Vertical guide
32 mm

The ruled sheet

ruled-paper-a4-8mm.svg · 770 B

A complete SVG dimensioned in millimetres. Print at 100% or Actual size to keep the selected spacing.

Every horizontal rule

13212198
24012198
34812198
45612198
56412198
67212198
78012198
88812198
99612198
1010412198
1111212198
1212012198
1312812198
1413612198
1514412198
1615212198
1716012198
1816812198
1917612198
2018412198

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?

  • A gap sits between two rules, so this loses one endpoint.

  • Exactly. The final rule is allowed because it lands on the boundary.

  • The edge margin is already in the geometry; permitted boundary rules are included.

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.

Sources