Skip to content

Named destinations are not found in PDF exported with LibreOffice Writer #1173

@gcrabbe

Description

@gcrabbe

MCVE

PyPDF2 seems unable to retrieve the named destinations in a sample PDF document exported with LibreOffice Writer 7.3:

lorem_ipsum.pdf

>>> import PyPDF2 
>>> r = PyPDF2.PdfReader("lorem_ipsum.pdf")
>>> r.metadata
{'/Creator': 'Writer', '/Producer': 'LibreOffice 7.3', '/CreationDate': "D:20220727095634+02'00'"}
>>> r.named_destinations
{}

At first, I suspected a bug in LibreOffice, but Poppler's pdfinfo utility seems to have no trouble with it:

$ pdfinfo -dests lorem_ipsum.pdf 
Page  Destination                 Name
   1 [ XYZ   92  736 null      ] "Dolor2520sit2520amet"
   2 [ XYZ   92  627 null      ] "Sodales2520posuere2520metus2520id"

URL anchor links also work as expected:

$ firefox lorem_ipsum.pdf#Sodales2520posuere2520metus2520id

Environment

$ python -m platform
Linux-5.15.0-41-generic-x86_64-with-glibc2.10

$ python -c "import PyPDF2;print(PyPDF2.__version__)"
2.8.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions