Merge pull request #133 from timb07/speedup
Speed up handling of PDFs with large imagespull/173/head
commit
259b29299e
|
@ -102,7 +102,7 @@ class PDFParser(PSStackParser):
|
||||||
return
|
return
|
||||||
pos += len(line)
|
pos += len(line)
|
||||||
self.fp.seek(pos)
|
self.fp.seek(pos)
|
||||||
data = self.fp.read(objlen)
|
data = bytearray(self.fp.read(objlen))
|
||||||
self.seek(pos+objlen)
|
self.seek(pos+objlen)
|
||||||
while 1:
|
while 1:
|
||||||
try:
|
try:
|
||||||
|
@ -120,6 +120,7 @@ class PDFParser(PSStackParser):
|
||||||
objlen += len(line)
|
objlen += len(line)
|
||||||
if self.fallback:
|
if self.fallback:
|
||||||
data += line
|
data += line
|
||||||
|
data = bytes(data)
|
||||||
self.seek(pos+objlen)
|
self.seek(pos+objlen)
|
||||||
# XXX limit objlen not to exceed object boundary
|
# XXX limit objlen not to exceed object boundary
|
||||||
log.debug('Stream: pos=%d, objlen=%d, dic=%r, data=%r...', pos, objlen, dic, data[:10])
|
log.debug('Stream: pos=%d, objlen=%d, dic=%r, data=%r...', pos, objlen, dic, data[:10])
|
||||||
|
|
Loading…
Reference in New Issue