Class: HexaPDF::Type::Form
- Inherits:
-
Stream
- Object
- Object
- Dictionary
- Stream
- HexaPDF::Type::Form
- Defined in:
- lib/hexapdf/type/form.rb
Overview
Represents a form XObject of a PDF document.
See: PDF1.7 s8.10
Constant Summary
Constants included from DictionaryFields
DictionaryFields::Boolean, DictionaryFields::PDFByteString, DictionaryFields::PDFDate
Constants inherited from Object
Object::NOT_DUPLICATABLE_CLASSES
Instance Attribute Summary collapse
-
#source_path ⇒ Object
Returns the path to the PDF file that was used when creating the form object.
Attributes inherited from Object
#data, #document, #must_be_indirect
Instance Method Summary collapse
-
#box ⇒ Object
Returns the rectangle defining the bounding box of the form.
-
#contents ⇒ Object
Returns the contents of the form XObject.
-
#contents=(data) ⇒ Object
Replaces the contents of the form XObject with the given string.
-
#process_contents(processor) ⇒ Object
Processes the content streams associated with the page with the given processor object.
-
#resources ⇒ Object
Returns the resource dictionary which is automatically created if it doesn’t exist.
Methods inherited from Stream
#must_be_indirect?, #raw_stream, #set_filter, #stream, #stream=, #stream_decoder, #stream_encoder, #stream_source
Methods inherited from Dictionary
#[], #[]=, define_field, #delete, #each, each_field, #empty?, field, #key?, #to_hash, #type
Methods inherited from Object
#<=>, #==, deep_copy, #deep_copy, #document?, #eql?, #gen, #gen=, #hash, #indirect?, #initialize, #inspect, #must_be_indirect?, #null?, #oid, #oid=, #type, #validate, #value, #value=
Constructor Details
This class inherits a constructor from HexaPDF::Object
Instance Attribute Details
#source_path ⇒ Object
Returns the path to the PDF file that was used when creating the form object.
This value is only set when the form object was created by using the image loading facility (i.e. when treating a single page PDF file as image) and not when the form object was created in any other way (i.e. manually created or already part of a loaded PDF file).
65 66 67 |
# File 'lib/hexapdf/type/form.rb', line 65 def source_path @source_path end |
Instance Method Details
#box ⇒ Object
Returns the rectangle defining the bounding box of the form.
68 69 70 |
# File 'lib/hexapdf/type/form.rb', line 68 def box self[:BBox] end |
#contents ⇒ Object
Returns the contents of the form XObject.
Note: This is the same as #stream but here for interface compatibility with Page.
75 76 77 |
# File 'lib/hexapdf/type/form.rb', line 75 def contents stream end |
#contents=(data) ⇒ Object
Replaces the contents of the form XObject with the given string.
Note: This is the same as #stream= but here for interface compatibility with Page.
82 83 84 |
# File 'lib/hexapdf/type/form.rb', line 82 def contents=(data) self.stream = data end |
#process_contents(processor) ⇒ Object
Processes the content streams associated with the page with the given processor object.
See: HexaPDF::Content::Processor
94 95 96 97 98 |
# File 'lib/hexapdf/type/form.rb', line 94 def process_contents(processor) self[:Resources] = {} if self[:Resources].nil? processor.resources = self[:Resources] Content::Parser.parse(contents, processor) end |
#resources ⇒ Object
Returns the resource dictionary which is automatically created if it doesn’t exist.
87 88 89 |
# File 'lib/hexapdf/type/form.rb', line 87 def resources self[:Resources] ||= document.wrap({}, type: :XXResources) end |