Class: Pdfrb::Content::HiddenTextDetector::Collector
- Inherits:
-
Object
- Object
- Pdfrb::Content::HiddenTextDetector::Collector
- Defined in:
- lib/pdfrb/content/hidden_text_detector.rb
Overview
Internal: collects text-show operations with their visibility state.
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
-
#initialize(page) ⇒ Collector
constructor
A new instance of Collector.
- #move_to_next_line ⇒ Object
- #non_stroke_alpha=(value) ⇒ Object
- #show_text(text) ⇒ Object
- #show_text_array(items) ⇒ Object
- #stroke_alpha=(value) ⇒ Object
- #text_rendering_mode=(value) ⇒ Object
Constructor Details
#initialize(page) ⇒ Collector
Returns a new instance of Collector.
116 117 118 119 120 121 122 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 116 def initialize(page) @items = [] @page = page @text_rendering_mode = 0 @non_stroke_alpha = 1.0 @stroke_alpha = 1.0 end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
114 115 116 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 114 def items @items end |
Instance Method Details
#move_to_next_line ⇒ Object
154 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 154 def move_to_next_line; end |
#non_stroke_alpha=(value) ⇒ Object
128 129 130 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 128 def non_stroke_alpha=(value) @non_stroke_alpha = value end |
#show_text(text) ⇒ Object
136 137 138 139 140 141 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 136 def show_text(text) return if text.nil? reason = current_reason @items << HiddenItem.new(text: text.to_s, reason: reason, page: @page) end |
#show_text_array(items) ⇒ Object
143 144 145 146 147 148 149 150 151 152 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 143 def show_text_array(items) return unless items.is_a?(::Array) items.each do |item| if item.is_a?(::String) show_text(item) end # Numeric items are positioning values; ignore them end end |
#stroke_alpha=(value) ⇒ Object
132 133 134 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 132 def stroke_alpha=(value) @stroke_alpha = value end |
#text_rendering_mode=(value) ⇒ Object
124 125 126 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 124 def text_rendering_mode=(value) @text_rendering_mode = value end |