Skip to content

Commit

Permalink
ROB: Accept DictionaryObject in /D of NamedDestination (#1720)
Browse files Browse the repository at this point in the history
in accordance with §2 page 584

Fixes #1710
  • Loading branch information
pubpub-zz committed Mar 18, 2023
1 parent af8d7c4 commit d5ac6ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pypdf/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,8 @@ def _get_named_destinations(
else: # case where Dests is in root catalog (PDF 1.7 specs, §2 about PDF1.1
for k__, v__ in tree.items():
val = v__.get_object()
if isinstance(val, DictionaryObject):
val = val["/D"].get_object()
dest = self._build_destination(k__, val)
if dest is not None:
retval[k__] = dest
Expand Down
8 changes: 8 additions & 0 deletions tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1350,3 +1350,11 @@ def test_iss1689():
name = "iss1689.pdf"
in_pdf = PdfReader(BytesIO(get_pdf_from_url(url, name=name)))
in_pdf.pages[0]


@pytest.mark.enable_socket()
def test_iss1710():
url = "https://nlp.stanford.edu/IR-book/pdf/irbookonlinereading.pdf"
name = "irbookonlinereading.pdf"
in_pdf = PdfReader(BytesIO(get_pdf_from_url(url, name=name)))
in_pdf.outline

0 comments on commit d5ac6ac

Please sign in to comment.