A minimal PDF

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.

It is also the document to try out on other people's machines before anything larger rides on the answer. Send it to a colleague, open it on a telephone, hand it to whoever looks after your computers: it is small enough to travel in an email and plain enough that it opens in anything with a screen. And it is light: ten thousand copies of it still fit on a memory stick with room left over.

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.

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

Examples near this one

Making the file smaller

The same document written twice, plainly and packed, with what each one weighs and what the packing saved.

Fonts embedded in the file

Text set in a font embedded in the file, cut down to the letters actually used, and still searchable, copyable and readable aloud.

Letters you draw yourself

A tick, a cross and a dash drawn by the program, added to the document as a font, and set among ordinary words.

Every example, by subject