write_pdf.py
The Python file of the “A minimal PDF” example. Two identical pages carrying the bones of an invoice in plain shapes, and not a word of text: a file of a dozen kilobytes, with no font embedded.
What this example is for
Open this one first. Two pages, identical, each carrying the bones of an invoice — a coloured band across the top, a frame around everything, and two dozen empty rectangles where the lines of a table would go — and not a word of text anywhere on either. That is the whole of what a document needs in order to exist: pages, and marks on them. There are two rather than one because putting the second in costs a single instruction, and that is worth seeing at the outset. Everything else shown on this site is built on top of this, never instead of it.
What this example shows
- A coloured band across the top of each page, and a frame round all.
- Two dozen empty rectangles, stacked, where a table's lines would go.
- Shapes and nothing but shapes, so the file carries no font at all.