class HexaPDF::Type::Trailer


Represents the PDF file trailer.

The file trailer is the starting point for the PDF's object tree. It links to the Catalog (the main PDF document structure) and the Info dictionary and holds the information necessary for encrypting the PDF document.

Since a PDF document can contain multiple revisions, each revision needs to have its own file trailer (see HexaPDF::Revision#trailer).

When cross-reference streams are used the information that is normally stored in the file trailer is stored directly in the cross-reference stream dictionary. However, a HexaPDF::Revision object's trailer dictionary is always of this type. Only when a cross-reference stream is written is the trailer integrated into the stream's dictionary.

See: PDF1.7 s7.5.5, s14.4; XRefStream

Field Definitions

NameType/Allowed ValuesRequiredDefault Value
RootHexaPDF::Type::Catalog or Hashfalsenil
EncryptHexaPDF::Dictionary or Hashfalsenil
InfoHexaPDF::Type::Info or Hashfalsenil
IDHexaPDF::PDFArray or Arrayfalsenil

Public Instance Methods


Returns the document's Catalog (see Type::Catalog), creating it if needed.


Returns the document's information dictionary (see Type::Info), creating it if needed.


Sets the /ID field to an array of two copies of a random string and returns this array.

See: PDF1.7 14.4


Updates the second part of the /ID field (the first part should always be the same for a PDF file, the second part should change with each write).