Skip to content

Error when read a not normal IndirectObject #248

@noword

Description

@noword

I create a PDF from k2opt, only export few pages.
When I try to get the bookmarks of this pdf file, It's raise ValueError: invalid literal for int() with base 10: ''

pdf = PdfFileReader("1.pdf")
pdf.getOutlines()

I think the problem is this pdf has some not normal IndrectObject, like this:
-1 0 R

In generic.py, the IndirectPattern should be:
IndirectPattern = re.compile(b_(r"[+-]?(\d+)\s+(\d+)\s+R[^a-zA-Z]"))
and maybe line 89 to 92 should be committed.

1.pdf

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