mozilla / mozilla/pdf.js

[Bug]: `/GoToE` links not working when `/R /P` (relation is child)

Open
#20,672 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core
Dominant language
JavaScript
Stars
53.9k
Forks
10.7k
Avg merge
18h 38m
Merged PRs (30d)
130

Description

Attach (recommended) or Link to PDF file

hypgotoe-example.pdf contains an embedded PDF document and /GoToE links from parent to child and from child back to parent.

Links with target related as child work as expected, but there are two links from child (actually, it is https://github.com/user-attachments/files/25358383/hypgotoe-example.pdf#ef=hypgotoe-child.pdf (only works with #20671 implemented) to parent that don’t work.

These are the following objects (from hypgotoe-child.pdf):

12 0 obj
<<
  /Type /Annot
  /Border [ 0 0 1 ]
  /H /I
  /C [ 0 1 1 ]
  /Rect [ 132.772 632.481 285.74 643.329 ]
  /Subtype /Link
  /A <<
    /Type /Action
    /S /GoToE
    /D (page.1)
    /T <<
      /R /P
    >>
  >>
>>
endobj

13 0 obj
<<
  /Type /Annot
  /Border [ 0 0 1 ]
  /H /I
  /C [ 0 1 1 ]
  /Rect [ 132.772 620.526 297.336 631.374 ]
  /Subtype /Link
  /A <<
    /Type /Action
    /S /GoToE
    /D (page.2)
    /T <<
      /R /P
    >>
  >>
>>
endobj
Web browser and its version

147.0.3

Operating system and its version

Fedora 43

PDF.js version

the one that comes with Firefox 147.0.3.

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem
  1. Open hypgotoe-example.pdf .

  2. Click any link that goes to embedded file.

  3. Try to click any of the links from the child document to the main one.

What is the expected behavior?

Links in hypgotoe-child.pdf to parent should back to main document as intended.

What went wrong?

Links from child (embedded document) to parent (main document) don’t work.

Link to a viewer

No response

Additional context

hypgotoe-child.pdf validates perfectly fine against the current Arlington model.

Example 2 from printed page 421 of the PDF-1.7 spec) contains:

2 0 obj
 << /Type /Action
    /S /GoToE
    /D (Chapter 1)
    /T << /R /P >>
 >>
endobj

Many thanks for your help.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the attached hypgotoe-example.pdf by opening the embedded hypgotoe-child.pdf and following its /GoToE links with /R /P. Trace the handling of those child-to-parent links and verify that both targets navigate back to the main document as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.