setasign\SetaPDF2\Core\Parser

Pdf A PDF parser

File: /SetaPDF v2/Core/Parser/Pdf.php
Old class name (alias): \SetaPDF_Core_Parser_Pdf

Class hierarchy

Summary

Properties

$_currentObject

The current object which is parsed

$_owner

The owner document

$_passOwningObjectToChilds

protected bool Pdf::$_passOwningObjectToChilds = false

If set to true the owning object is passed to parsed child elements

This is needed to create a relation between a parsed object and its owning element. The complete chain will be able to get a relation to the owning document. Needed for example for handling en- and decryption of strings or streams.

$_reader

The reader class

$_tokenizer

The tokenizer


Methods

__construct()

The constructor.

Parameters
$reader : \SetaPDF_Core_Reader_ReaderInterface
 

_ensureExpectedValue()

private Pdf::_ensureExpectedValue (
string $token,
?string $expectedType
): true

Ensures that the token will evaluate to an expected object type (or not).

Parameters
$token : string
 
$expectedType : ?string
 
Exceptions

Throws Pdf\InvalidTokenException

_getNextToken()

protected Pdf::_getNextToken (
void
): string|false

Get the next token.

_readValue()

private Pdf::_readValue (
?string $token,
?string $expectedType = null
): \SetaPDF_Core_Type_AbstractType|false

Read a value based on a token.

Parameters
$token : ?string
 
$expectedType : ?string
 
Exceptions

Throws Pdf\InvalidTokenException

Throws \setasign\SetaPDF2\Core\Exception

Throws \UnexpectedValueException

cleanUp()

public Pdf::cleanUp (
void
): void

Released memory and resources.

getOwner()

Get the owner pdf document.

getPdfVersion()

public Pdf::getPdfVersion (
void
): string

Get the PDF version.

Exceptions

Throws Exception

getReader()

Get the reader object.

Exceptions

Throws Exception

getTokenizer()

Get the tokenizer object.

readValue()

public Pdf::readValue (
?string $expectedType = null
): \SetaPDF_Core_Type_AbstractType|false

Read a value.

Parameters
$expectedType : ?string
 
Exceptions

Throws \setasign\SetaPDF2\Core\Exception

Throws Pdf\InvalidTokenException

reset()

public Pdf::reset (
int $pos = 0
): void

Reset the reader to a specific position.

Parameters
$pos : int
 

setOwner()

public Pdf::setOwner (): void

Set the owner pdf document.

Parameters
$owner : \SetaPDF_Core_Type_Owner
 

setPassOwningObjectToChilds()

public Pdf::setPassOwningObjectToChilds (
bool $passOwningObjectToChilds = true
): void

Define if the owning object should be passed to it's childs.

Parameters
$passOwningObjectToChilds : bool
 
See
  • $_passOwningObjectToChilds

setReader()

Set the reader object.

Parameters
$reader : \SetaPDF_Core_Reader_ReaderInterface
 

skipUntilToken()

public Pdf::skipUntilToken (
string $token,
bool $inToken = false
): bool

Skips tokens until a special token is found.

This method can be used to e.g. jump over binary inline image data.

Parameters
$token : string
 
$inToken : bool

Defines if the token should match exactly or if a strpos should be used to find the token.