Excerpt: Non-rectangular links are coming to PDF 2.0! This article offers some background to link technology in PDF and discusses the forthcoming Extension to PDF 2.0.
About the author: Peter Wyatt is the PDF Association’s CTO and an independent technology consultant with deep file format and parsing expertise, who is a developer and researcher actively working on PDF technologies … Read more
PDF’s Link annotations enable PDF to support various forms of hyperlinking. Link annotations do not themselves contain any visible content; their purpose is to define the location and shape of a ‘hot area’ on a PDF page, and the actions to occur when a user clicks within the hot area.
Since PDF 1.0 the hot area of a Link annotation was limited to a single rectangle defined by the annotation’s Rect entry. In 2004 PDF 1.6 introduced QuadPoints to facilitate links with multiple quadrilateral areas. This extension enabled efficient hyperlinking when line-wrapping, where a single Link annotation object could be used if the underlying text (for example) was broken across one or more lines on the same page, a common occurrence in Table of Contents with long titles, or in justified columnar text:
Unlike HTML image maps, however, the page graphics underlying Link annotations are not limited to bitmap images but can also be device-independent vector graphics or text, or any combination. This provides a far better on-screen experience when zooming.
The IsMap feature of URI actions
PDF 1.1 (1996) added the “IsMap” feature to the URI action to support mouse tracking and the communication of the (X,Y) mouse position to a web server:
A URI action’s IsMap attribute indicates that when the action is performed, the (x, y) position of the mouse within the parent link annotation (relative to the upper left hand corner of the link rectangle) should be concatenated to the end of the URI, preceded by a question mark.
This feature mirrors the “image map” capability found in HTML and thus allows HTML web pages and their image map behavior to be faithfully captured into PDF files, but relies on a PDF document and matching web page to process incoming clicks. To demonstrate this, a simple PDF test file (uri-ismap-test.pdf) containing a single image with a single Link annotation and URI action with IsMap set true is located in the GitHub safedocs repository. For demonstration purposes, a matching web page is also in GitHub and is served from the PDF Association at https://safedocs.pdfa.org/uri-ismap-test.html.
Since the feature invokes an external URL, which might be potentially malicious, it is also expected that all interactive viewers will confirm with users before loading the URL into their web browser.
Until now PDF has never had a purely viewer-only equivalent to the HTML concept of image maps that allow specification of arbitrarily shaped hot areas. ISO 24654 Document management – Portable Document Format – Non-Rectangular Links introduces a Path key to PDF 2.0’s Link annotations that defines an arbitrarily complex set of paths composed of lines and Bezier curves with fallback behavior defined as using QuadPoints (if present) or the Rect bounding box.
The architecture, engineering and construction (AEC) industries originally proposed this feature to the PDF for Engineering ISO working group (ISO TC 171 SC 2 WG 7) as the AEC sector regularly uses non-rectangular symbols in technical documentation. The new PDF 2.0 non-rectangular Link annotations solve this need, enabling a superior, more intuitive user experience for complex documents.
The new PDF 2.0 non-rectangular link capability isn’t just for AEC organizations; it’s useful for any irregular-shaped area in any PDF that requires hyperlinking. Examples might include:
- a PDF with a map of the world could have complex Paths along each country’s border, with each country hyperlinked to different chapters in the same PDF file.
- the non-rectangular symbols in flowcharts or process diagrams could be hyperlinked to related content in the same or separate PDFs
- a circular or irregular company logo could be linked to the company’s website with some appropriate visual effect (e.g., a link border in the company’s palette).
If your organization or documents could benefit from adopting ISO/TS 24654 Document management – Portable Document Format – Non-Rectangular Links, be sure to speak with your PDF vendor to confirm their support schedule. All draft extension specifications are available to members of the PDF Association through our Category A liaison with ISO for review and comment by technical developers. Developers can also discuss these extensions in the appropriate PDF Association technical community.
In upcoming articles, I will highlight some of the exciting new features in other PDF 2.0 extensions currently in their final ISO balloting phase, as well as a short series of technical articles on how to correctly declare, support and distinguish private data from PDF extensions in PDF processors.
2022-05-02 update: In the May 2022 ISO meetings, ISO TC 171 SC 2 WG7 decided to withhold publication of ISO/TS 24654 in order to resolve some last-minute technical concerns discovered during implementation by a vendor. ISO/TS 24654 will be reworked to correct these issues and is expected to be published in 2023.