Add hyperlink support with destination previews on hover #1

Open
opened 2026-11-17 10:55:03 -06:00 by edjmir · 0 comments
Owner

Context

Links in a PDF (citations, table-of-contents entries, glossary and acronym
references, web addresses) are drawn but do nothing. Following an internal link in
other viewers means losing your place. GNOME Document Viewer avoids this by
showing a preview of the destination when you hover over the link.

Current behavior

  • Hovering a link shows nothing, and the cursor stays the same.
  • Clicking a link does nothing.
  • There is no way to peek at where a citation or acronym leads without scrolling
    away manually.
  • There is no way to return to the previous position after a jump.

Expected behavior

  • Hover: with the Select tool, the link is outlined and the cursor becomes a
    pointing hand. After about 350 ms a floating preview appears.
    • Internal links: the preview shows the rendered destination. It is the whole
      page for page-level destinations such as slides, or a window around the
      destination point for citations.
    • Web links: the preview shows the address.
    • Missing destination: if a named destination does not exist in the file, a
      tooltip says so instead of showing nothing.
  • Click: an internal link scrolls to its destination. http, https and mailto links open in the desktop's default handler. Other schemes (file:, javascript: and so on) are never opened.
  • Back and Forward: Alt+←, Alt+→, View menu items and a "↩ Back" toolbar button return to the previous place after a jump.
  • Responsiveness: previews render off the UI thread, so heavy pages never freeze the window.
  • Dismissal: the preview closes on press, scroll, tool change, zoom or when the pointer leaves the link.

Acceptance criteria

  • Links are read from the document (area and target) in all common flavours, including named destinations.
  • A region of a page can be rendered, correctly under all four view rotations.
  • The hover preview, click-to-follow and Back/Forward behave as described above.
  • URI opening is restricted to http, https and mailto.
  • Tests, clippy and docs (CLAUDE.md, CHANGELOG.md, README.md) are updated.

Known limits (out of scope)

  • The popup cannot be entered or clicked.
  • Named actions (NextPage and similar), Launch and remote links are not followed.
  • Previews show the file on disk, so pending edits are not drawn in them.
### Context Links in a PDF (citations, table-of-contents entries, glossary and acronym references, web addresses) are drawn but do nothing. Following an internal link in other viewers means losing your place. GNOME Document Viewer avoids this by showing a preview of the destination when you hover over the link. ### Current behavior - Hovering a link shows nothing, and the cursor stays the same. - Clicking a link does nothing. - There is no way to peek at where a citation or acronym leads without scrolling away manually. - There is no way to return to the previous position after a jump. ### Expected behavior - Hover: with the Select tool, the link is outlined and the cursor becomes a pointing hand. After about 350 ms a floating preview appears. - Internal links: the preview shows the rendered destination. It is the whole page for page-level destinations such as slides, or a window around the destination point for citations. - Web links: the preview shows the address. - Missing destination: if a named destination does not exist in the file, a tooltip says so instead of showing nothing. - Click: an internal link scrolls to its destination. http, https and mailto links open in the desktop's default handler. Other schemes (file:, javascript: and so on) are never opened. - Back and Forward: Alt+←, Alt+→, View menu items and a "↩ Back" toolbar button return to the previous place after a jump. - Responsiveness: previews render off the UI thread, so heavy pages never freeze the window. - Dismissal: the preview closes on press, scroll, tool change, zoom or when the pointer leaves the link. Acceptance criteria - [x] Links are read from the document (area and target) in all common flavours, including named destinations. - [x] A region of a page can be rendered, correctly under all four view rotations. - [x] The hover preview, click-to-follow and Back/Forward behave as described above. - [x] URI opening is restricted to http, https and mailto. - [x] Tests, clippy and docs (CLAUDE.md, CHANGELOG.md, README.md) are updated. Known limits (out of scope) - The popup cannot be entered or clicked. - Named actions (NextPage and similar), Launch and remote links are not followed. - Previews show the file on disk, so pending edits are not drawn in them.
edjmir self-assigned this 2026-11-17 10:55:03 -06:00
edjmir changed title from PDF to Add hyperlink support with destination previews on hover 2026-11-17 10:57:41 -06:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
edjmir/OpenPdfReader#1
No description provided.