class HexaPDF:: Revision
| Parent | Object |
|---|---|
| Included Modules |
Enumerable |
Embodies one revision of a PDF file, either the initial version or an incremental update.
The purpose of a Revision object is to manage the objects and the trailer of one revision. These objects can either be added manually or loaded from a cross-reference section or stream. Since a PDF file can be incrementally updated, it can have multiple revisions.
If a revision doesn’t have an associated cross-reference section, it wasn’t created from a PDF file.
See: PDF2.0 s7.5.6, Revisions
Attributes
The callable object responsible for loading objects.
The trailer dictionary
The associated XRefSection object.
Public Class Methods
Creates a new Revision object.
Options:
xref_section-
An
XRefSectionobject that contains information on how to load objects. If this option is specified, then aloaderor a block also needs to be specified! - loader
-
The loader object needs to respond to
calltaking a cross-reference entry and returning the loaded object. If noxref_sectionis supplied, this value is not used.If a block is given, it is used instead of the loader object.
Public Instance Methods
Adds the given object (needs to be a HexaPDF::Object) to this revision and returns it.
Deletes the object specified either by reference or by object number from this revision by marking it as free.
If the mark_as_free option is set to false, the object is really deleted.
Calls the given block for every object of the revision, or, if only_loaded is true, for every already loaded object.
Objects that are loadable via an associated cross-reference section but are currently not loaded, are loaded automatically if only_loaded is false.
Calls the given block once for each object that has been modified since it was loaded. Added or eleted object and cross-reference streams as well as signature dictionaries are ignored.
delete-
If the
deleteargument is set totrue, each modified object is deleted from the active objects. all-
If the
allargument is set totrue, added object and cross-reference streams are also yielded.
Note that this also means that for revisions without an associated cross-reference section all loaded objects will be yielded.
Returns the next free object number for adding an object to this revision.
Returns the object for the given reference or object number if such an object is available in this revision, or nil otherwise.
If the revision has an entry but one that is pointing to a free entry in the cross-reference section, an object representing PDF null is returned.
Returns true if the revision contains an object
-
for the exact reference if the argument responds to :oid, or else
-
for the given object number.
Updates the stored object to point to the given HexaPDF::Object wrapper, returning the object if successful or nil otherwise.
If obj isn’t stored in this revision or the stored object doesn’t contain the same HexaPDF::PDFData object as the given object, nothing is done.
This method should only be used if the wrong wrapper class is stored (e.g. because auto-detection didn’t or couldn’t work correctly) and thus needs correction.