Class: Acrobat::Jso
- Inherits:
-
Object
- Object
- Acrobat::Jso
- Defined in:
- lib/acrobat/app.rb
Instance Attribute Summary collapse
-
#ole_obj ⇒ Object
readonly
Returns the value of attribute ole_obj.
Instance Method Summary collapse
- #clear_form ⇒ Object
- #console ⇒ Object
- #field_count ⇒ Object
- #field_names ⇒ Object
- #fill_form(hash) ⇒ Object
- #find_field(name_or_number) ⇒ Object
- #get_field(name) ⇒ Object
-
#initialize(ole) ⇒ Jso
constructor
A new instance of Jso.
- #ole_get_field(field) ⇒ Object
- #set_field(name, value) ⇒ Object
Constructor Details
#initialize(ole) ⇒ Jso
Returns a new instance of Jso.
243 244 245 |
# File 'lib/acrobat/app.rb', line 243 def initialize(ole) @ole_obj = ole end |
Instance Attribute Details
#ole_obj ⇒ Object (readonly)
Returns the value of attribute ole_obj.
241 242 243 |
# File 'lib/acrobat/app.rb', line 241 def ole_obj @ole_obj end |
Instance Method Details
#clear_form ⇒ Object
286 287 288 |
# File 'lib/acrobat/app.rb', line 286 def clear_form ole_obj.resetForm end |
#console ⇒ Object
260 261 262 |
# File 'lib/acrobat/app.rb', line 260 def console @console ||= ole_obj.console end |
#field_count ⇒ Object
282 283 284 |
# File 'lib/acrobat/app.rb', line 282 def field_count ole_obj.numFields end |
#field_names ⇒ Object
264 265 266 267 268 269 270 |
# File 'lib/acrobat/app.rb', line 264 def field_names result = [] 0.upto(field_count -1) do |i| result << ole_obj.getNthFieldName(i) end result end |
#fill_form(hash) ⇒ Object
290 291 292 293 294 295 |
# File 'lib/acrobat/app.rb', line 290 def fill_form(hash) clear_form hash.each do |k,v| set_field(k,v) end end |
#find_field(name_or_number) ⇒ Object
247 248 249 250 251 252 253 254 |
# File 'lib/acrobat/app.rb', line 247 def find_field(name_or_number) case name_or_number when String,Symbol ole_get_field(name_or_number.to_s) when Number ole_get_field(name_or_number) end end |
#get_field(name) ⇒ Object
277 278 279 280 |
# File 'lib/acrobat/app.rb', line 277 def get_field(name) field = find_field(name) field.Value if field end |
#ole_get_field(field) ⇒ Object
256 257 258 |
# File 'lib/acrobat/app.rb', line 256 def ole_get_field(field) ole_obj.getField(field) end |
#set_field(name, value) ⇒ Object
272 273 274 275 |
# File 'lib/acrobat/app.rb', line 272 def set_field(name,value) field = find_field(name) field.Value = value if field end |