Two Orders, One Frame, One Bottom Edge

A pad of printed stationery has the frame on the paper already: a frame for the lines, a rule under it, the total below the rule. What goes in the frame is a different length every time. An order of four lines leaves a hand's breadth of white above the rule and an order of a dozen fills it, so two sheets from the same pad look like two different documents — and the usual answer, padding the short one with empty rows, is a row somebody can write in afterwards.

Here the frame is filled instead. Whatever room the lines leave is shared out among them in equal parts, once they have all been measured, so the last line lands on the bottom edge whichever order is being printed. The headings and the total stay exactly where the paper puts them. The two notes at the foot of the page do the same with words rather than rows: their lines are moved apart until each note reaches the bottom of its frame, so notes of unequal length end on one line — and a limit is given along with the frame, so a note of two lines keeps the spacing it came with.

What This Example Shows

  • The bottom edge is the same whether the order runs to four lines or fifteen.
  • The headings and the total stay where the printed paper puts them.
  • Two notes of unequal length brought to one common last line.

The Source Code, Complete

Nothing is left out and nothing is simplified: this is the program exactly as it runs, for the developer who uses this library. The third is the description itself: a plain list of what the page has to say, which is what the service is sent.

Read the Rust source Read the Python source Read the JSON source

The Document Itself

Open the document in English Open the document in French Open the document in German Open the document in Spanish Open the document in Italian Open the document in Portuguese

Two Orders, One Frame, One Bottom Edge, first page

The Same Document in Other Languages

This document weighs 15.4 kB

Examples Near This One

A Multi-Page Invoice Table

Twelve invoice lines is one page and thirty is two, the second taking up the first's header and layout.

A Self-Paginating Table

A long table handed over whole, deciding for itself where the pages break: its heading on top of every page, its footnote under every page, a quarter's cell spanning its rows and written again at the top of the next page when a page cuts it, and a note you draw under each page at the exact place the table reports.

Cells Merged Down the Rows

A specification sheet whose cells are merged down the rows: each group named once beside all of its rows, with one note beside them; the thin lines stop at those cells' edges, and a note too long for the rows it covers makes them grow.

Columns Measured from Their Cells

One parts list twice: four columns sharing the width equally, then the reference, the quantity and the price each as wide as their own widest cell and the description given everything they leave.

Every example, by subject