Merge pull request #133 from timb07/speedup

Speed up handling of PDFs with large images
pull/173/head
Tata Ganesh 2018-07-15 11:27:35 +05:30 committed by GitHub
commit 259b29299e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -102,7 +102,7 @@ class PDFParser(PSStackParser):
return
pos += len(line)
self.fp.seek(pos)
data = self.fp.read(objlen)
data = bytearray(self.fp.read(objlen))
self.seek(pos+objlen)
while 1:
try:
@ -120,6 +120,7 @@ class PDFParser(PSStackParser):
objlen += len(line)
if self.fallback:
data += line
data = bytes(data)
self.seek(pos+objlen)
# XXX limit objlen not to exceed object boundary
log.debug('Stream: pos=%d, objlen=%d, dic=%r, data=%r...', pos, objlen, dic, data[:10])