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

Showing Page One Before the File Has Arrived

The same document written twice: once as it is, once with its first page placed at the start of the file. The page gives, for each of the two, the number of bytes a browser must have received before it shows page 1.

Every Paper Size, on Its Own Page

One page for each paper size the library names, from A0 down to A6 and the American sizes, each giving its size in millimetres and inches; then pages laid on their side or upside down, and a banner ten metres long.

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.

Every example, by subject