Table of contents
Namespace: Com\Tecnick\Pdf\Parser
class Parser extends Xref
Extends: Xref
Source: src/Parser.php:43
PHP class for parsing PDF documents.
Constants
DEFAULT_MAX_STREAM_SIZE
Default maximum size in bytes of a single decoded stream (32MB).
public const DEFAULT_MAX_STREAM_SIZE = 33554432
Source: src/Parser.php:48
LIMIT_REFERENCE_CYCLE
Limit event kind: a reference cycle left a reference unresolved.
public const LIMIT_REFERENCE_CYCLE = 'reference_cycle'
Source: src/Parser.php:71
LIMIT_RESOLUTION_DEPTH
Limit event kind: the resolution depth limit left a reference unresolved.
public const LIMIT_RESOLUTION_DEPTH = 'resolution_depth'
Source: src/Parser.php:66
Methods
__construct()
Initialize the PDF parser
public __construct(array<string,bool|int> $cfg = [])
Parameters:
$cfg(array<string,bool|int>): Configuration parameters: ‘ignore_filter_errors’: if true, ignore filter decoding errors; ‘decode_streams’: if true, decode stream payloads while parsing regular indirect objects; ‘max_stream_size’: maximum size in bytes of a single decoded stream, 0 means unlimited; ‘max_resolution_depth’: maximum number of indirect object resolutions in flight at once, values below 1 are clamped to 1; ‘max_nesting_depth’: maximum nesting depth of array and dictionary objects, values below 1 are clamped to 1; ‘strict_limits’: if true, raise a LimitException as soon as a limit or a reference cycle leaves an object unresolved.
Source: src/Parser.php:137
getLimitWarnings()
Return one description per kind of limit event recorded during the last parse.
The list is empty when no limit was reached, and always empty in strict mode, where the first event raises a LimitException instead.
public getLimitWarnings(): array<int,string>
Returns: array<int,string>
Source: src/Parser.php:909
parse()
Parse a PDF document into an array of objects
public parse(string $data): array{0: XrefData, 1: array<string,array<int,RawObjectArray>>}
Parameters:
$data(string): PDF data to parse.
Returns: array{0: XrefData, 1: array<string,array<int,RawObjectArray>>}
Throws:
Source: src/Parser.php:181