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.
115 116 117 118 119 120 121 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 115 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.
113 114 115 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 113 def items @items end |
Instance Method Details
#move_to_next_line ⇒ Object
153 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 153 def move_to_next_line; end |
#non_stroke_alpha=(value) ⇒ Object
127 128 129 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 127 def non_stroke_alpha=(value) @non_stroke_alpha = value end |
#show_text(text) ⇒ Object
135 136 137 138 139 140 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 135 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
142 143 144 145 146 147 148 149 150 151 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 142 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
131 132 133 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 131 def stroke_alpha=(value) @stroke_alpha = value end |
#text_rendering_mode=(value) ⇒ Object
123 124 125 |
# File 'lib/pdfrb/content/hidden_text_detector.rb', line 123 def text_rendering_mode=(value) @text_rendering_mode = value end |