Skip to content

Commit 9e4e648

Browse files
committed
feat: add missing attributes from pdfminer
1 parent 4a304d6 commit 9e4e648

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/paves/miner.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,14 @@ def __init__(
405405
self.stroke = path.stroke
406406
self.fill = path.fill
407407
self.evenodd = path.evenodd
408-
self.stroking_color = path.gstate.scolor
409-
self.non_stroking_color = path.gstate.ncolor
408+
gstate = path.gstate
409+
self.graphicstate = gstate
410+
self.stroking_color = gstate.scolor
411+
self.non_stroking_color = gstate.ncolor
412+
self.scs = gstate.scs
413+
self.ncs = gstate.ncs
410414
self.original_path = transformed_path
411-
self.dashing_style = path.gstate.dash
415+
self.dashing_style = gstate.dash
412416

413417
def get_pts(self) -> str:
414418
return ",".join("%.3f,%.3f" % p for p in self.pts)
@@ -520,8 +524,12 @@ def __init__(
520524
font = textstate.font
521525
assert font is not None
522526
self.fontname = font.fontname
527+
self.render_mode = textstate.render_mode
523528
self.graphicstate = gstate
524-
self.ncs = self.graphicstate.ncs
529+
self.stroking_color = gstate.scolor
530+
self.non_stroking_color = gstate.ncolor
531+
self.scs = gstate.scs
532+
self.ncs = gstate.ncs
525533
self.adv = glyph.adv
526534
(a, b, c, d, e, f) = matrix
527535
scaling = textstate.scaling
@@ -622,6 +630,7 @@ def __repr__(self) -> str:
622630
def analyze(self, laparams: LAParams) -> None:
623631
for obj in self._objs:
624632
obj.analyze(laparams)
633+
# FIXME: Should probably inherit mcstack somehow
625634
LTContainer.add(self, LTAnno("\n"))
626635

627636
def find_neighbors(
@@ -646,6 +655,7 @@ def add(self, obj: LTComponent) -> None: # type: ignore[override]
646655
if isinstance(obj, LTChar) and self.word_margin:
647656
margin = self.word_margin * max(obj.width, obj.height)
648657
if self._x1 < obj.x0 - margin:
658+
# FIXME: Should probably inherit mcstack somehow
649659
LTContainer.add(self, LTAnno(" "))
650660
self._x1 = obj.x1
651661
super().add(obj)
@@ -709,6 +719,7 @@ def add(self, obj: LTComponent) -> None: # type: ignore[override]
709719
if isinstance(obj, LTChar) and self.word_margin:
710720
margin = self.word_margin * max(obj.width, obj.height)
711721
if obj.y1 + margin < self._y0:
722+
# FIXME: Should probably inherit mcstack somehow
712723
LTContainer.add(self, LTAnno(" "))
713724
self._y0 = obj.y0
714725
super().add(obj)

0 commit comments

Comments
 (0)