One letter each, in one file

A mailing goes out: four letters, four different customers, one file. The company that folds them and puts them into envelopes has to know where each letter starts and how many pages it runs to. That normally comes on a work sheet beside the file, and the day the two stop agreeing, somebody receives a letter written for somebody else.

Here the file says it itself, and it survives a letter growing a page: everything below it moves, nothing above it has to be redone, and the contents page at the front is still right. That is what matters when the mailing is created rather than typeset, because the one thing nobody can do is check four hundred of them by eye. The company that fills the envelopes reads the same file to know where to cut and what to fold.

What this example shows

  • Four letters, one for each customer, behind one contents page.
  • No page numbers: each recipient takes the pages that follow.
  • A line of the contents leads to the recipient, not to a page.

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

Examples near this one

A commercial invoice

An invoice whose lines and totals fall where the text puts them, and whose QR code lets a telephone pay the exact sum into the exact account with nothing retyped.

A delivery note

The note that travels with the goods: a barcode against each article, a box the receiver ticks, and the consignment's own code.

A payslip

A payslip: eighteen contribution lines with employee and employer shares, the month against the year to date.

A landscape certificate

A certificate whose border, ribbon and seal are drawn as lines rather than photographed: sharp at any size, and a fraction of the weight.

A boarding pass

A boarding pass carrying, as a QR code, the one line the gates at an airport read — one character out of place and it is refused.

Every example, by subject