A couple of bugfixes. Thanks to Sean Manefield.

git-svn-id: https://pdfminerr.googlecode.com/svn/trunk/pdfminer@185 1aa58f4a-7d42-0410-adbc-911cccaed67c
pull/1/head
yusuke.shinyama.dummy 2010-03-12 13:47:39 +00:00
parent 23be96c49e
commit 85c5476623
2 changed files with 29 additions and 3 deletions

View File

@ -19,7 +19,7 @@ Python PDF parser and analyzer
<div align=right class=lastmod>
<!-- hhmts start -->
Last Modified: Sat Feb 27 03:58:45 UTC 2010
Last Modified: Fri Mar 12 13:45:59 UTC 2010
<!-- hhmts end -->
</div>
@ -348,6 +348,7 @@ no stream header is displayed for the ease of saving it to a file.
<hr noshade>
<h2>Changes</h2>
<ul>
<li> 2010/03/12: A couple of bugfixes. Thanks to Sean Manefield.
<li> 2010/02/27: Changed the way of internal layout handling. (LTTextItem -&gt; LTChar)
<li> 2010/02/15: Several bugfixes. Thanks to Sean.
<li> 2010/02/13: Bugfix and enhancement. Thanks to Andr&eacute; Auzi.

View File

@ -69,6 +69,20 @@ class PDFTextState(object):
self.scaling, self.leading, self.render, self.rise,
self.matrix, self.linematrix))
def copy(self):
obj = PDFTextState()
obj.font = self.font
obj.fontsize = self.fontsize
obj.charspace = self.charspace
obj.wordspace = self.wordspace
obj.scaling = self.scaling
obj.leading = self.leading
obj.render = self.render
obj.rise = self.rise
obj.matrix = self.matrix
obj.linematrix = self.linematrix
return obj
def reset(self):
self.matrix = MATRIX_IDENTITY
self.linematrix = (0, 0)
@ -89,6 +103,17 @@ class PDFGraphicState(object):
self.flatness = None
return
def copy(self):
obj = PDFGraphicState()
obj.linewidth = self.linewidth
obj.linecap = self.linecap
obj.linejoin = self.linejoin
obj.miterlimit = self.miterlimit
obj.dash = self.dash
obj.intent = self.intent
obj.flatness = self.flatness
return obj
def __repr__(self):
return ('<PDFGraphicState: linewidth=%r, linecap=%r, linejoin=%r, '
' miterlimit=%r, dash=%r, intent=%r, flatness=%r>' %
@ -126,7 +151,7 @@ class PDFResourceManager(object):
return CMapDB.get_cmap(cmapname)
except CMapDB.CMapNotFound:
if strict: raise
return CMapDB.CMap()
return CMap()
def get_font(self, objid, spec):
if objid and objid in self.fonts:
@ -347,7 +372,7 @@ class PDFPageInterpreter(object):
return x
def get_current_state(self):
return (self.ctm, self.textstate, self.graphicstate)
return (self.ctm, self.textstate.copy(), self.graphicstate.copy())
def set_current_state(self, state):
(self.ctm, self.textstate, self.graphicstate) = state