-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Has MCVEA minimal, complete and verifiable example helps a lot to debug / understand feature requestsA minimal, complete and verifiable example helps a lot to debug / understand feature requestsis-robustness-issueFrom a users perspective, this is about robustnessFrom a users perspective, this is about robustness
Milestone
Description
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 0Here 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Has MCVEA minimal, complete and verifiable example helps a lot to debug / understand feature requestsA minimal, complete and verifiable example helps a lot to debug / understand feature requestsis-robustness-issueFrom a users perspective, this is about robustnessFrom a users perspective, this is about robustness