-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dealing with invalid bookmarks #90
Comments
Hi @MrGou, |
Hi @MrGou, |
Sorry for the delay in responding. I've tested your whl but couldn't see any difference. Invalid bookmarks seem to be skipped entirely. So they are not returned by the following code: def printBookmarkTree(bookmark_list):
i = 0
for item in bookmark_list:
if isinstance(item, list):
# recursive call
i += 1
# print(i)
printBookmarkTree(item)
else:
page = reader.getDestinationPageNumber(item) + 1
print('\t' * i + item.title + '\t' + str(page))
i -= 1
printBookmarkTree(reader.getOutlines()) By the way, it seems that I had to import PyPDF4 under the name import pypdf as PyPDF4 Not sure whether this is intended. Unfortunately, I am not able to share an example file, as they are highly confidential. I can't even say how to reproduce the issue: how the issue occured is what I'm trying to find out in the first place |
No problem for delay and your problem to share documents
you define directly those two functions directly in the shell
This will output the raw data data from the pdf and then the decrypted data. |
I'm dealing with a collection of PDF files that contain invalid bookmarks: in Acrobat, they show in the bookmark tree, but the bookmark properties shows that they have no destination.
Using the getOutlines() method does not return these bookmarks at all. I was hoping that I could extract these invalid bookmarks and fix them with pyPDF4 (in my specific case, I would set them to the destination of the previous bookmark), but since they're not listed, that's not possible.
Is there a tweak I could apply to get these invalid bookmarks (and update them)?
Thanks!
R.
The text was updated successfully, but these errors were encountered: