A Minimal PDF
Two identical pages that draw the structure of an invoice with lines and rectangles, without a word of text: the file is about a dozen kilobytes and embeds no font.
Some documents are meant to be read, not taken over: a price offer whose figures a competitor should not paste into their own, a draft contract, an exam paper. In an ordinary PDF every word is text: anyone who opens the file can select it and copy it, or hand the file to a program that pulls all of it out in a second.
Here the library sets the page as usual — fonts, kerning, line breaks — and then writes each letter as the shape it makes on the page, traced from the outline of its font. The reader sees exactly the same price offer, but the file holds no text: no word can be selected or searched for, the prices cannot be copied into another document, and a program that extracts text finds nothing. One setting on the document does it; the rest of the code is the code of any other page.
The note at the foot of the page states what it costs: a screen reader has nothing to read aloud, the document has no structure for accessibility, and the file is larger, since every letter is written out as a shape. It stops copying, not looking: the page can still be printed or photographed.
Nothing is left out and nothing is simplified: this is the program exactly as it runs, for the developer who uses this library.
Read the Rust source Read the Python source
Open the document in English Open the document in French Open the document in German Open the document in Spanish Open the document in Italian Open the document in Portuguese
Two identical pages that draw the structure of an invoice with lines and rectangles, without a word of text: the file is about a dozen kilobytes and embeds no font.
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.
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.
One document written twice: once uncompressed, once compressed. The page gives both file sizes and what the compression saved.
A page that opens without a password and prints like any other, but asks the reading software to forbid copying and pasting its text. The text is encrypted in the file: a program reading it byte by byte finds no sentence in it.
A page nothing shows until its password is typed in: no first line, no preview, no picture of it anywhere. The password is given on the example's page, to be tried.