Skip to content

Commit

Permalink
Read Indirect Objects with a sign, fixes #248
Browse files Browse the repository at this point in the history
  • Loading branch information
mstamy2 committed May 19, 2016
1 parent 5735cb7 commit b030b7f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions PyPDF2/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

ObjectPrefix = b_('/<[tf(n%')
NumberSigns = b_('+-')
IndirectPattern = re.compile(b_(r"(\d+)\s+(\d+)\s+R[^a-zA-Z]"))
IndirectPattern = re.compile(b_(r"[+-]?(\d+)\s+(\d+)\s+R[^a-zA-Z]"))


def readObject(stream, pdf):
Expand Down Expand Up @@ -87,9 +87,6 @@ def readObject(stream, pdf):
return readObject(stream, pdf)
else:
# number object OR indirect reference
if tok in NumberSigns:
# number
return NumberObject.readFromStream(stream)
peek = stream.read(20)
stream.seek(-len(peek), 1) # reset to start
if IndirectPattern.match(peek) != None:
Expand Down

0 comments on commit b030b7f

Please sign in to comment.