Table of contents
Namespace: Com\Tecnick\Pdf\Import
class ObjectMap
Source: src/Import/ObjectMap.php:35
Tracks the mapping from source object references to destination PDF object numbers and maintains a queue of objects that still need to be serialized into the output PDF.
Methods
allocate()
Allocate a new destination object number for a source reference and mark it as in-progress.
If the source reference is already mapped, returns the existing number.
public allocate(string $srcRef, int &$pon): int
Parameters:
$srcRef(string): Source object reference.$pon(int): Current PDF object number counter (modified in place).
Returns: int: The allocated destination object number.
Source: src/Import/ObjectMap.php:92
enqueue()
Mark a source reference as resolved and enqueue its serialized PDF data.
public enqueue(string $srcRef, string $pdfData): void
Parameters:
$srcRef(string): Source object reference.$pdfData(string): Serialized PDF object data.
Source: src/Import/ObjectMap.php:124
flush()
Drain the queue and return all pending serialized PDF object data.
Clears the queue.
public flush(): string
Returns: string: Concatenated PDF object data for all queued objects.
Source: src/Import/ObjectMap.php:136
get()
Get the destination object number for a source reference.
public get(string $srcRef): int
Parameters:
$srcRef(string): Source object reference.
Returns: int: Destination object number.
Throws:
- ImportException: If the reference has not been allocated.
Source: src/Import/ObjectMap.php:113
getMap()
Return the full map for inspection (e.g. to resolve /XObject references in resource dicts).
public getMap(): array<string,int>
Returns: array<string,int>
Source: src/Import/ObjectMap.php:152
has()
Check whether a source reference has already been mapped to a destination object number.
public has(string $srcRef): bool
Parameters:
$srcRef(string): Source object reference (e.g. “3_0”).
Returns: bool: True if already mapped.
Source: src/Import/ObjectMap.php:66
isInProgress()
Check whether allocation of a source reference is already in progress (cycle detection).
public isInProgress(string $srcRef): bool
Parameters:
$srcRef(string): Source object reference.
Returns: bool: True if in progress.
Source: src/Import/ObjectMap.php:78