revert some of the patches.

git-svn-id: https://pdfminerr.googlecode.com/svn/trunk/pdfminer@91 1aa58f4a-7d42-0410-adbc-911cccaed67c
pull/1/head
yusuke.shinyama.dummy 2009-04-26 14:51:46 +00:00
parent 3c4936ad28
commit c66f2d64e1
2 changed files with 15 additions and 15 deletions

View File

@ -60,12 +60,12 @@ class PDFBaseXRef(object):
def objids(self):
if self.objid_ranges:
for objid_range in self.objid_ranges:
for objid in xrange(objid_range.get_start_id(), objid_range.get_end_id() + 1):
yield objid
for objid_range in self.objid_ranges:
for objid in xrange(objid_range.get_start_id(), objid_range.get_end_id() + 1):
yield objid
else:
for objid in self.offsets:
yield objid
for objid in self.offsets:
yield objid
return
## PDFXRef
@ -628,15 +628,15 @@ class PDFParser(PSStackParser):
raise PDFNoValidXRef('Unexpected EOF')
if 2 <= self.debug:
print >>stderr, 'read_xref_from: start=%d, token=%r' % (start, token)
try:
if isinstance(token, int):
# XRefStream: PDF-1.5
self.seek(pos)
self.reset()
xref = PDFXRefStream()
xref.load(self, debug=self.debug)
except:
else:
if token is self.KEYWORD_XREF:
self.nextline()
self.nextline()
xref = PDFXRef()
xref.load(self, debug=self.debug)
xrefs.append(xref)
@ -689,7 +689,7 @@ class PDFParser(PSStackParser):
## PDFObjStrmParser
##
class PDFObjStrmParser(PDFParser):
def __init__(self, doc, data):
try:
from cStringIO import StringIO
@ -697,7 +697,7 @@ class PDFObjStrmParser(PDFParser):
from StringIO import StringIO
PDFParser.__init__(self, doc, StringIO(data))
return
def flush(self):
self.add_results(*self.popall())
return

View File

@ -167,11 +167,11 @@ class PDFStream(PDFObject):
# end. remove chars from the end to try and decompress the buffer
while len(buf) > 10:
try:
# will get errors if the document is encrypted.
dco = zlib.decompressobj()
return dco.decompress(buf)
except:
buf = buf[:-1]
# will get errors if the document is encrypted.
dco = zlib.decompressobj()
return dco.decompress(buf)
except zlib.error:
buf = buf[:-1]
raise Exception, "zlib.error while decompressing data"
def decode(self):