class HexaPDF::Content::Processor::CompositeBox

Represents a box composed of GlyphBox objects.

The bounding box methods lower_left, lower_right, upper_left, upper_right are computed by just using the first and last boxes, assuming the boxes are arranged from left to right in a straight line.

Attributes

boxes[R]

The text boxes contained in this positioned text object.

Public Class Methods

new() click to toggle source

Creates an empty object.

# File lib/hexapdf/content/processor.rb, line 161
def initialize
  @boxes = []
end

Public Instance Methods

<<(glyph_box) click to toggle source

Appends the given text glyph box.

# File lib/hexapdf/content/processor.rb, line 166
def <<(glyph_box)
  @boxes << glyph_box
  self
end
[](index) click to toggle source

Returns the glyph box at the given index, or nil if the index is out of range.

# File lib/hexapdf/content/processor.rb, line 172
def [](index)
  @boxes[index]
end
each {|glyph_box| block} → composite click to toggle source
each → Enumerator

Iterates over all contained glyph boxes.

# File lib/hexapdf/content/processor.rb, line 181
def each(&block)
  return to_enum(__method__) unless block_given?
  @boxes.each(&block)
  self
end
lower_left → [llx, lly] click to toggle source

Returns the lower left coordinate

# File lib/hexapdf/content/processor.rb, line 196
def lower_left
  @boxes[0].lower_left
end
lower_right → [lrx, lry] click to toggle source

Returns the lower right coordinate

# File lib/hexapdf/content/processor.rb, line 204
def lower_right
  @boxes[-1].lower_right
end
string() click to toggle source

Returns the concatenated text of the boxes.

# File lib/hexapdf/content/processor.rb, line 188
def string
  @boxes.map(&:string).join('')
end
upper_left → [ulx, uly] click to toggle source

Returns the upper left coordinate

# File lib/hexapdf/content/processor.rb, line 212
def upper_left
  @boxes[0].upper_left
end
upper_right → [urx, ury] click to toggle source

Returns the upper right coordinate.

# File lib/hexapdf/content/processor.rb, line 220
def upper_right
  @boxes[-1].upper_right
end