class TCPDF_PARSER (View source)

Properties

protected $xref

XREF data.

protected $objects

Array of PDF objects.

Methods

__construct(string $data, array $cfg = array())

Parse a PDF document an return an array of objects.

setConfig(array $cfg)

Set the configuration parameters.

array
getParsedData()

Return an array of parsed PDF document objects.

array
getXrefData(int $offset = 0, array $xref = array())

Get Cross-Reference (xref) table and trailer data from PDF document data.

array
decodeXref(int $startxref, array $xref = array())

Decode the Cross-Reference section

array
decodeXrefStream(int $startxref, array $xref = array())

Decode the Cross-Reference Stream section

array
getRawObject(int $offset = 0)

Get object type, raw value and offset to next object

array
getIndirectObject(string $obj_ref, int $offset = 0, bool $decoding = true)

Get content of indirect object.

array
getObjectVal(string $obj)

Get the content of object, resolving indect object reference if necessary.

array
decodeStream(array $sdic, string $stream)

Decode the specified stream.

Error(string $msg)

Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true.

Details

__construct(string $data, array $cfg = array())

Since: 1.0.000 (2011-05-24)

Parse a PDF document an return an array of objects.

Parameters

string $data

PDF data to parse.

array $cfg

Array of configuration parameters: 'die_for_errors' : if true termitate the program execution in case of error, otherwise thows an exception; 'ignore_filter_decoding_errors' : if true ignore filter decoding errors; 'ignore_missing_filter_decoders' : if true ignore missing filter decoding errors.

protected setConfig(array $cfg)

Set the configuration parameters.

Parameters

array $cfg

Array of configuration parameters: 'die_for_errors' : if true termitate the program execution in case of error, otherwise thows an exception; 'ignore_filter_decoding_errors' : if true ignore filter decoding errors; 'ignore_missing_filter_decoders' : if true ignore missing filter decoding errors.

array getParsedData()

Since: 1.0.000 (2011-06-26)

Return an array of parsed PDF document objects.

Return Value

array

Array of parsed PDF document objects.

protected array getXrefData(int $offset = 0, array $xref = array())

Since: 1.0.000 (2011-05-24)

Get Cross-Reference (xref) table and trailer data from PDF document data.

Parameters

int $offset

xref offset (if know).

array $xref

previous xref array (if any).

Return Value

array

containing xref and trailer data.

protected array decodeXref(int $startxref, array $xref = array())

Since: 1.0.000 (2011-06-20)

Decode the Cross-Reference section

Parameters

int $startxref

Offset at which the xref section starts (position of the 'xref' keyword).

array $xref

Previous xref array (if any).

Return Value

array

containing xref and trailer data.

protected array decodeXrefStream(int $startxref, array $xref = array())

Since: 1.0.003 (2013-03-16)

Decode the Cross-Reference Stream section

Parameters

int $startxref

Offset at which the xref section starts.

array $xref

Previous xref array (if any).

Return Value

array

containing xref and trailer data.

protected array getRawObject(int $offset = 0)

Since: 1.0.000 (2011-06-20)

Get object type, raw value and offset to next object

Parameters

int $offset

Object offset.

Return Value

array

containing object type, raw value and offset to next object

protected array getIndirectObject(string $obj_ref, int $offset = 0, bool $decoding = true)

Since: 1.0.000 (2011-05-24)

Get content of indirect object.

Parameters

string $obj_ref

Object number and generation number separated by underscore character.

int $offset

Object offset.

bool $decoding

If true decode streams.

Return Value

array

containing object data.

protected array getObjectVal(string $obj)

Since: 1.0.000 (2011-06-26)

Get the content of object, resolving indect object reference if necessary.

Parameters

string $obj

Object value.

Return Value

array

containing object data.

protected array decodeStream(array $sdic, string $stream)

Since: 1.0.000 (2011-06-22)

Decode the specified stream.

Parameters

array $sdic

Stream's dictionary array.

string $stream

Stream to decode.

Return Value

array

containing decoded stream data and remaining filters.

Error(string $msg)

Since: 1.0.000 (2011-05-23)

Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true.

Parameters

string $msg

The error message