Class: Tabula::Extraction::LineExtractor::LineToOperator

Inherits:
OperatorProcessor
  • Object
show all
Defined in:
lib/tabula/pdf_line_extractor.rb

Instance Method Summary collapse

Instance Method Details

#process(operator, arguments) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
# File 'lib/tabula/pdf_line_extractor.rb', line 81

def process(operator, arguments)
  drawer = self.context
  x, y = arguments[0], arguments[1]
  ppos = drawer.TransformedPoint(x.floatValue, y.floatValue)

  l = java.awt.geom.Line2D::Float.new(drawer.currentX, drawer.currentY, ppos.getX, ppos.getY)

  drawer.currentPath << l if l.horizontal? or l.vertical?

  drawer.currentX, drawer.currentY = ppos.getX, ppos.getY
end