Class: Tabula::Extraction::LineExtractor::StrokePathOperator

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

Instance Method Summary collapse

Instance Method Details

#process(operator, arguments) ⇒ Object



140
141
142
143
144
145
146
147
148
149
# File 'lib/tabula/pdf_line_extractor.rb', line 140

def process(operator, arguments)
  drawer = self.context
  strokeColorComps = drawer.getGraphicsState.getStrokingColor.getJavaColor.getRGBColorComponents(nil)
  color_filter = drawer.options[:line_color_filter] || lambda{|c| true } #by default, use all lines, regardless of color
  if color_filter.call(strokeColorComps)
    drawer.currentPath.each { |segment| drawer.addRuling(segment, strokeColorComps.to_a) }
  end

  drawer.currentPath = []
end