Revert the wrong fix.

pull/1/head
Yusuke Shinyama 2014-03-28 17:24:03 +09:00
parent b18e8c549d
commit 57adad55d7
1 changed files with 2 additions and 1 deletions

View File

@ -218,7 +218,7 @@ class PDFXRefStream(PDFBaseXRef):
if not isinstance(stream, PDFStream) or stream['Type'] is not LITERAL_XREF: if not isinstance(stream, PDFStream) or stream['Type'] is not LITERAL_XREF:
raise PDFNoValidXRef('Invalid PDF stream spec.') raise PDFNoValidXRef('Invalid PDF stream spec.')
size = stream['Size'] size = stream['Size']
index_array = stream.get('Index', (1, size)) index_array = stream.get('Index', (0, size))
if len(index_array) % 2 != 0: if len(index_array) % 2 != 0:
raise PDFSyntaxError('Invalid index number') raise PDFSyntaxError('Invalid index number')
self.ranges.extend(choplist(2, index_array)) self.ranges.extend(choplist(2, index_array))
@ -246,6 +246,7 @@ class PDFXRefStream(PDFBaseXRef):
for (start, nobjs) in self.ranges: for (start, nobjs) in self.ranges:
if start <= objid and objid < start+nobjs: if start <= objid and objid < start+nobjs:
index += objid - start index += objid - start
break
else: else:
index += nobjs index += nobjs
else: else: