Links and marks on placed text

Links and marks hung on text the engine has already placed: a band behind a line, an underline, a boxed cell — every rectangle taken from what the layout and the table report afterwards, none of it measured by hand.

The hard part of a link on text is not the link: it is knowing where the line ended up. So the text and the table are drawn first and then asked where each line and each cell landed, and the marks are hung on the rectangles they report.

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

  • The exact position of every line, reported by the layout once it has run.
  • The exact position of a cell, asked for by its row and its column.
  • Highlights, underlines and clickable areas built from those positions.

The code, in full

The same document is written twice, once in each language. Both files are shown in full, with the code coloured on the server, and can be copied in one click.

The document itself

The same document is written in each of these languages. Open the one you want to look at.

Open the document in English Open the document in French

Read the Rust source Read the Python source

First page of Links and marks on placed text

What this document weighs

Before 110,681 bytes
Now 40,181 bytes
Saved 63.7 %

Not one mark on the page changed. See every document measured.

Examples near this one

A slideshow that runs itself

Thirteen slides, each stating the effect it arrives by — all twelve the standard defines — how long that effect takes and how long the slide stands before the next one comes. The file opens full screen, which is the only place a reader reads any of it.

A handbook that says how it wants to be read

Four pages that state what happens the moment the file is opened: which page it opens on and how much of the window that page fills, the bookmarks shown beside it, the pages two at a time, a print dialogue already filled in, and the address its relative links are read against.

PDF417 codes

A page of PDF417 codes, drawn as stacked bars.

Every example, by subject