class Acrobat::Jso
Constants
- Value
Attributes
doc[R]
ole_obj[R]
Public Class Methods
new(doc,ole)
click to toggle source
# File lib/acrobat/jso.rb, line 7 def initialize(doc,ole) @doc = doc @ole_obj = ole end
Public Instance Methods
clear_form()
click to toggle source
# File lib/acrobat/jso.rb, line 81 def clear_form ole_obj.resetForm end
console()
click to toggle source
# File lib/acrobat/jso.rb, line 25 def console @console ||= ole_obj.console end
export_as_fdf(name)
click to toggle source
# File lib/acrobat/jso.rb, line 42 def export_as_fdf(name) end
field_count()
click to toggle source
# File lib/acrobat/jso.rb, line 77 def field_count ole_obj.numFields().to_int end
field_names()
click to toggle source
# File lib/acrobat/jso.rb, line 33 def field_names result = [] count = field_count 0.upto(count-1) do |i| result << ole_obj.getNthFieldName(i) end result end
fields_hash()
click to toggle source
# File lib/acrobat/jso.rb, line 49 def fields_hash result = {} field_names.each_with_object( result ) do |name, h| h[name] = get_field(name) end end
fill_form(hash)
click to toggle source
# File lib/acrobat/jso.rb, line 85 def fill_form(hash) clear_form hash.each do |k,v| set_field(k,v) end end
find_field(name_or_number)
click to toggle source
# File lib/acrobat/jso.rb, line 12 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)
click to toggle source
# File lib/acrobat/jso.rb, line 72 def get_field(name) field = find_field(name) field.Value if field end
import_fdf(path)
click to toggle source
# File lib/acrobat/jso.rb, line 45 def import_fdf(path) end
ole_get_field(field)
click to toggle source
# File lib/acrobat/jso.rb, line 21 def ole_get_field(field) ole_obj.getField(field) end
set_field(name,value)
click to toggle source
// Enumerate through all of the fields in the document. for (var i = 0; i < this.numFields; i++) console.println(“Field[” + i + “] = ” + this.getNthFieldName(i));
# File lib/acrobat/jso.rb, line 61 def set_field(name,value) begin field = find_field(name) field.Value = value.to_s if field rescue require 'pry' binding.pry nil end end
show_console()
click to toggle source
# File lib/acrobat/jso.rb, line 29 def show_console console.show end