patch from pietvo.
git-svn-id: https://pdfminerr.googlecode.com/svn/trunk/pdfminer@190 1aa58f4a-7d42-0410-adbc-911cccaed67cpull/1/head
parent
fa13122f09
commit
a6523d1a9a
|
@ -242,16 +242,17 @@ class PSBaseParser(object):
|
||||||
pos = self.fp.tell()
|
pos = self.fp.tell()
|
||||||
buf = ''
|
buf = ''
|
||||||
while 0 < pos:
|
while 0 < pos:
|
||||||
|
prevpos = pos
|
||||||
pos = max(0, pos-self.BUFSIZ)
|
pos = max(0, pos-self.BUFSIZ)
|
||||||
self.fp.seek(pos)
|
self.fp.seek(pos)
|
||||||
s = self.fp.read(self.BUFSIZ)
|
s = self.fp.read(prevpos-pos)
|
||||||
if not s: break
|
if not s: break
|
||||||
while 1:
|
while 1:
|
||||||
n = max(s.rfind('\r'), s.rfind('\n'))
|
n = max(s.rfind('\r'), s.rfind('\n'))
|
||||||
if n == -1:
|
if n == -1:
|
||||||
buf = s + buf
|
buf = s + buf
|
||||||
break
|
break
|
||||||
yield buf+s[n:]
|
yield s[n:]+buf
|
||||||
s = s[:n]
|
s = s[:n]
|
||||||
buf = ''
|
buf = ''
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue