Table of contents
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
- since: 2026-05-03
- category: Library
- author: Nicola Asuni info@tecnick.com
- copyright: 2002-2026 Nicola Asuni - Tecnick.com LTD
- license: https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
- link: https://github.com/tecnickcom/tc-lib-pdf
- phpstan-import-type: RawObjectArray from \Com\Tecnick\Pdf\Parser\Process\RawObject
- phpstan-import-type: ResolvedPage from PageResolver
Methods
__construct()
File: ResourceCloner.php line 88
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 165
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
- throws: ImportCorruptedSourceException
- throws: ImportException
- throws: Exception
Return values
string —
Serialized PDF resource dictionary, e.g. “« /Font « /F1 7 0 R » »”.
enqueueObject()
File: ResourceCloner.php line 317
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
- throws: ImportException
- throws: Exception
Return values
int —
Allocated destination object number.
getContentStream()
File: ResourceCloner.php line 119
public getContentStream(array<string, mixed> $pageDict, SourceDocument $src) : array{bytes: string, filter: string, length: int}
Handles a single /Contents reference as well as an array of references, which are decoded and concatenated into one stream.
Parameters
- $pageDict : array<string, mixed>: Effective page dictionary.
- $src : SourceDocument: Source document.
Tags
- throws: ImportCorruptedSourceException If the content stream cannot be extracted.
- throws: ImportUnsupportedFeatureException If /Contents is missing.
Return values
array{bytes: string, filter: string, length: int}
getPon()
File: ResourceCloner.php line 100
public getPon() : int
Return values
int