ResourceCloner

Deep-copies objects from the source document into the destination PDF using an ObjectMap for reference remapping. Returns serialized PDF object bytes. Streams and strings are encrypted with the key of the destination document.

Namespace: Com\Tecnick\Pdf\Import

File: ResourceCloner.php line 43

Deep-copies objects from the source document into the destination PDF using an ObjectMap for reference remapping. Returns serialized PDF object bytes. Streams and strings are encrypted with the key of the destination document.

Tags

Methods

__construct()

File: ResourceCloner.php line 93

public __construct(int $pon[, int $pdfa = 0 ][, Encrypt|null $encrypt = null ]) : mixed

Parameters

  • $pon : int: Current PDF object number (passed by value; read the updated counter back via getPon()).
  • $pdfa : int = 0: PDF/A part of the destination document (0 when PDF/A is not active).
  • $encrypt : Encrypt|null = null: Encryption object of the destination document; a disabled one is used when null.

Tags

  • throws: Exception

cloneResources()

File: ResourceCloner.php line 212

public cloneResources(array<string, mixed> $resources, SourceDocument $src, ObjectMap $map[, int $ownerNum = 0 ]) : string

Returns a serialized PDF resource dictionary string with remapped object numbers.

Parameters

  • $resources : array<string, mixed>: Resource dictionary.
  • $src : SourceDocument: Source document.
  • $map : ObjectMap: Object map for reference remapping.
  • $ownerNum : int = 0: Number of the object the dictionary is written into, used as encryption key for the strings it contains.

Tags

Return values

string —

Serialized PDF resource dictionary, e.g. “« /Font « /F1 7 0 R » »”.

enqueueObject()

File: ResourceCloner.php line 368

public enqueueObject(string $srcRef, SourceDocument $src, ObjectMap $map) : int

Parameters

  • $srcRef : string: Source object reference key (see SourceDocument::refToKey()).
  • $src : SourceDocument: Source document.
  • $map : ObjectMap: Object map.

Tags

Return values

int —

Allocated destination object number.

getContentStream()

File: ResourceCloner.php line 127

public getContentStream(array<string, mixed> $pageDict, SourceDocument $src) : array{bytes: string, filter: string, length: int, found: bool}

Handles a single /Contents reference, an array of references, and a reference to an array of references. Multiple streams are decoded and concatenated into one stream.

Parameters

  • $pageDict : array<string, mixed>: Effective page dictionary.
  • $src : SourceDocument: Source document.

Tags

Return values

array{bytes: string, filter: string, length: int, found: bool} —

The ‘found’ flag is false when no content stream object could be located, which is distinct from an empty but valid stream.

getPon()

File: ResourceCloner.php line 106

public getPon() : int

Return values

int