class HexaPDF::Importer

Parent

The Importer class manages the process of copying objects from one Document to another.

It may seem unnecessary using an importer containing state for the task. However, by retaining some information about the already copied objects we can make sure that already imported objects don't get imported again.

Two types of indirect objects are never imported from one document to another: the catalog and page tree nodes. If the catalog was imported, the whole source document would be imported. And if one page tree node would imported, the whole page tree would be imported.

See: Document#import

Public Class Methods

for(destination)

Returns the Importer object for copying objects to the destination document.

new(destination)

Initializes a new importer that can import objects to the destination document.

Public Instance Methods

import(object, source: nil)

Imports the given object to the destination object and returns the imported object.

Note: Indirect objects are automatically added to the destination document but direct or simple objects are not.

The source argument should be nil or set to the source document of the imported object. If it is nil, the source document is dynamically identified. If this identification is not possible and the source document would be needed, an error is raised.