Skip to content
LpdfDocsv0.36-r1119.4

Lpdf is pre-release. The XML schema and SDK APIs can change between releases.

Link

Wraps any layout content in a clickable hyperlink. The link is active in PDF viewers that support annotations. In a PDF/X document, made for a printer, links print their content and are not clickable.

Attribute Type Default Description
href URL — Required. Link destination: a URL, or #id to jump to the bookmark with that id
data-href string — Dot-path: sets href from the data. See Attributes from data
gap spacing — Gap between child elements
ocg string — print or screen: shown only in print, or only on screen. See Print and screen content
<link href="https://lpdf.io">
<text color="#1a73e8" font-size="m">Visit lpdf.io</text>
</link>
<link href="https://lpdf.io">
<img name="logo" width="80pt"/>
</link>

# and a bookmark’s id jump to that bookmark, in the same PDF.

<column gap="m">
<link href="#terms">
<text color="#1a73e8">Read the terms</text>
</link>
<bookmark label="Terms" id="terms"/>
<text font-size="l">Terms</text>
</column>

A link to an id that no bookmark has is left out of the PDF: its content is drawn, but it is not clickable. In a table of contents, href="#" alone jumps to the bookmark of the entry it is in.

data-href sets the destination from the data, and href is what stays when no data is passed or the path has no value. Text inside the link can be bound too. See Attributes from data.

<link href="https://example.com" data-href="product.url">
<text data-value="product.name" color="#1a73e8">Product</text>
</link>

data-value does not change href.