Class: PdfForms::Pdf
- Inherits:
-
Object
- Object
- PdfForms::Pdf
- Includes:
- NormalizePath
- Defined in:
- lib/pdf_forms/pdf.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#field(name) ⇒ Object
the field object for the named field.
-
#fields ⇒ Object
list of field objects for all defined fields.
-
#initialize(path, pdftk, options = {}) ⇒ Pdf
constructor
A new instance of Pdf.
Methods included from NormalizePath
Constructor Details
#initialize(path, pdftk, options = {}) ⇒ Pdf
Returns a new instance of Pdf.
11 12 13 14 15 16 |
# File 'lib/pdf_forms/pdf.rb', line 11 def initialize(path, pdftk, = {}) @options = @path = normalize_path(path) raise IOError unless File.readable?(@path) @pdftk = pdftk end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/pdf_forms/pdf.rb', line 9 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/pdf_forms/pdf.rb', line 9 def path @path end |
Instance Method Details
#field(name) ⇒ Object
the field object for the named field
27 28 29 |
# File 'lib/pdf_forms/pdf.rb', line 27 def field(name) fields.detect{ |f| f.name == name } end |
#fields ⇒ Object
list of field objects for all defined fields
Initialize the object with utf8_fields: true to get utf8 encoded field names.
22 23 24 |
# File 'lib/pdf_forms/pdf.rb', line 22 def fields @fields ||= read_fields end |