Table of contents
Namespace: Com\Tecnick\Pdf\Import
File: SourceDocument.php line 40
Wraps a parsed source PDF document and provides access to its objects and trailer.
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: XrefData from \Com\Tecnick\Pdf\Parser\Process\XrefStream
Methods
__construct()
File: SourceDocument.php line 83
public __construct(string $data[, array<string, mixed> $cfg = [] ]) : mixed
Parameters
- $data : string: PDF binary data.
- $cfg : array<string, mixed> = []: Parser configuration.
Tags
- throws: ImportCorruptedSourceException If the PDF cannot be parsed.
- throws: ImportResourceLimitException If the nesting depth limit is exceeded, or any limit is reached with ‘strict_limits’.
- throws: ImportUnsupportedFeatureException If the PDF is encrypted.
findObject()
File: SourceDocument.php line 276
public findObject(string $ref) : array<int, mixed>|null
Parameters
- $ref : string: Source object reference.
Tags
- phpstan-return: array<int, RawObjectArray>|null
Return values
array<int, mixed>|null
getId()
File: SourceDocument.php line 225
public getId() : string
Return values
string —
SHA-256 hash of the raw PDF data.
getObject()
File: SourceDocument.php line 261
public getObject(string $ref) : array<int, mixed>
Parameters
- $ref : string: Source object reference.
Tags
- phpstan-return: array<int, RawObjectArray>
- throws: ImportCorruptedSourceException If the reference does not exist.
Return values
array<int, mixed>
getParserWarnings()
File: SourceDocument.php line 205
public getParserWarnings() : array<int, string>
Return values
array<int, string>
getTrailer()
File: SourceDocument.php line 236
public getTrailer() : array<string, mixed>
Tags
- phpstan-return: XrefData[’trailer']
Return values
array<string, mixed>
getXref()
File: SourceDocument.php line 246
public getXref() : array<string, int|string>
Return values
array<string, int|string>
objectCount()
File: SourceDocument.php line 312
public objectCount() : int
Return values
int
refToKey()
File: SourceDocument.php line 291
public static refToKey(string $refStr) : string
Returns the “objnum_generation” form, e.g. “3_0”.
Parameters
- $refStr : string: Raw reference string from the parsed PDF (e.g. “3 0 R”).
Tags
- throws: ImportCorruptedSourceException On malformed reference.
Return values
string —
Object ref key (e.g. “3_0”).