class HexaPDF::Type::Catalog
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
Public Instance Methods
acro_form(create: false)
click to toggle source
Returns the main AcroForm
object.
-
If an
AcroForm
object exists, thecreate
argument is not used. -
If no
AcroForm
object exists andcreate
istrue
, a newAcroForm
object with default settings will be created and returned. -
If no
AcroForm
object exists andcreate
isfalse
,nil
is returned.
See: AcroForm::Form
# File lib/hexapdf/type/catalog.rb, line 109 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?()
click to toggle source
Returns true
since catalog objects must always be indirect.
# File lib/hexapdf/type/catalog.rb, line 88 def must_be_indirect? true end
pages()
click to toggle source
Returns the root node of the page tree.
See: PageTreeNode
# File lib/hexapdf/type/catalog.rb, line 95 def pages self[:Pages] ||= document.add({Type: :Pages}) end
Private Instance Methods
perform_validation() { |"A PDF document needs a page tree", true| ... }
click to toggle source
Ensures that there is a valid page tree.
Calls superclass method
HexaPDF::Dictionary#perform_validation
# File lib/hexapdf/type/catalog.rb, line 122 def perform_validation(&block) super unless key?(:Pages) yield("A PDF document needs a page tree", true) value[:Pages] = document.add({Type: :Pages}) value[:Pages].validate(&block) end end