Showing page one before the file has arrived

Open the book below: the first page appears the instant you click it, as though the file carried a single page — and it carries 357. That is the whole of what this example is for, and it is worth more the longer the document gets: a catalogue, a manual, a report of two hundred pages behaves the same way.

An ordinary PDF makes you wait for all of it. What tells reading software where the pages are sits at the very end of the file, so nothing at all can be shown until the last of it has arrived — click a long document and you watch an empty window. This one is written the other way round: it opens with page one and everything page one needs, so the reading software has enough to draw it after 1% of the file, and the rest keeps coming while you are already reading. Turn to a page in the middle and it fetches that page rather than the whole book. Nothing on any page changes, and somebody who already has the file on their own machine sees no difference: this buys back the wait of the person opening it over the network.

What this example shows

  • A long book whose first page is there the instant you click it.
  • The rest arriving quietly behind it, while you read.
  • Jumping to a page in the middle fetching that page, not the book.

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 minimal PDF

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.

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