Class: HexaPDF::Type::Catalog
- Inherits:
-
Dictionary
- Object
- Object
- Dictionary
- HexaPDF::Type::Catalog
- Defined in:
- lib/hexapdf/type/catalog.rb
Overview
Represents the PDF’s catalog dictionary which is at the root of the document’s object hierarchy.
The catalog dictionary is linked via the /Root entry from the Trailer.
See: PDF1.7 s7.7.2, Trailer
Constant Summary
Constants included from DictionaryFields
DictionaryFields::Boolean, DictionaryFields::PDFByteString, DictionaryFields::PDFDate
Instance Attribute Summary
Attributes inherited from Object
#data, #document, #must_be_indirect
Instance Method Summary collapse
-
#acro_form(create: false) ⇒ Object
Returns the main AcroForm object.
-
#must_be_indirect? ⇒ Boolean
Returns
truesince catalog objects must always be indirect. -
#pages ⇒ Object
Returns the root node of the page tree.
Methods inherited from Dictionary
#[], #[]=, define_field, define_type, #delete, #each, each_field, #empty?, field, #key?, #to_h, type, #type
Methods inherited from Object
#<=>, #==, #cache, #cached?, #clear_cache, deep_copy, #deep_copy, #document?, #eql?, #gen, #gen=, #hash, #indirect?, #initialize, #inspect, #null?, #oid, #oid=, #type, #validate, #value, #value=
Constructor Details
This class inherits a constructor from HexaPDF::Object
Instance Method Details
#acro_form(create: false) ⇒ Object
Returns the main AcroForm object.
-
If an AcroForm object exists, the
createargument is not used. -
If no AcroForm object exists and
createistrue, a new AcroForm object with default settings will be created and returned. -
If no AcroForm object exists and
createisfalse,nilis returned.
See: AcroForm::Form
110 111 112 113 114 115 116 117 118 |
# File 'lib/hexapdf/type/catalog.rb', line 110 def acro_form(create: false) if (form = self[:AcroForm]) form elsif create form = self[:AcroForm] = document.add({}, type: :XXAcroForm) form.set_default_appearance_string form end end |
#must_be_indirect? ⇒ Boolean
Returns true since catalog objects must always be indirect.
89 90 91 |
# File 'lib/hexapdf/type/catalog.rb', line 89 def must_be_indirect? true end |
#pages ⇒ Object
Returns the root node of the page tree.
See: PageTreeNode
96 97 98 |
# File 'lib/hexapdf/type/catalog.rb', line 96 def pages self[:Pages] ||= document.add({Type: :Pages}) end |