Skip to content

Unknown Destination Type: 0 #604

@ethanabrooks

Description

@ethanabrooks

I have the following code to extract the outline from a PDF:

from PyPDF2 import PdfFileReader

with open("thyroid.pdf", "rb") as f:
   pdf = PdfFileReader(f)
   bookmarks = pdf.getOutlines()
   for b in bookmarks:
       print(pdf.getDestinationPageNumber(b) + 1) #page count starts from 0

Here is the PDF: thyroid.pdf
When I run it I get:

Traceback (most recent call last):
  File "/Users/ethanbrooks/pdf2graph/parse.py", line 5, in <module>
    bookmarks = pdf.getOutlines()
  File "/Users/ethanbrooks/pdf2graph/.venv/lib/python3.9/site-packages/PyPDF2/pdf.py", line 1362, in getOutlines
    outline = self._buildOutline(node)
  File "/Users/ethanbrooks/pdf2graph/.venv/lib/python3.9/site-packages/PyPDF2/pdf.py", line 1444, in _buildOutline
    outline = self._buildDestination(title, dest)
  File "/Users/ethanbrooks/pdf2graph/.venv/lib/python3.9/site-packages/PyPDF2/pdf.py", line 1425, in _buildDestination
    return Destination(title, page, typ, *array)
  File "/Users/ethanbrooks/pdf2graph/.venv/lib/python3.9/site-packages/PyPDF2/generic.py", line 1065, in __init__
    raise utils.PdfReadError("Unknown Destination Type: %r" % typ)
PyPDF2.utils.PdfReadError: Unknown Destination Type: 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Has MCVEA minimal, complete and verifiable example helps a lot to debug / understand feature requestsis-robustness-issueFrom a users perspective, this is about robustness

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions