Links and marks on placed text

The hard part of putting a link on a word is not the link. It is knowing where that word ended up, on a page whose text was broken into lines by the layout rather than by you. Guess the rectangle and it stays right until somebody edits the sentence, changes the font, or opens the French version of the same document.

A pale band is painted behind a paragraph's first line, one line is underlined and made clickable, and one table cell is boxed and made clickable. Nothing on the page is measured by hand, which means the marks stay right when the text is edited, translated or set in another font.

What this example shows

  • A pale band behind the first line of a paragraph, exactly on it.
  • An underlined line and a boxed table cell, both clickable.
  • Marks that stay put when the sentence is edited, translated or reset.

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

Links and marks on placed text, first page

Optimised, this document weighs 12.8 kB — at least 85 % lighter than most PDF generators would write it

The document is lighter than it was, and every page still looks exactly the same. See this document's row in the table of every example.

Examples near this one

A slideshow that runs itself

A plain first slide and thirteen more, each stating the effect it arrives by — the twelve the PDF standard (ISO 32000) defines — how long that effect takes and how long the slide stands before the next one comes. The file asks to open full screen, which is where the effects play, and a link on the first slide shows the screen again, brought in by dissolving.

Internal and external links

A document made to be followed rather than looked at: every line of the contents lands on the page it names, and every page leads back to where it came from.

A story that carries on further in

Two stories over two pages: each one begins in a column of the front page and carries on in a column of the second, and the two swap sides on the way. The file says which column follows which, so reading software goes on with the story it is on.

PDF417 codes

The code on identity documents and shipping papers: it carries far more text than a row of bars, and it survives a laser scanner dragged across it.

Every example, by subject