Documentation

Encoding extends PDFObject
in package

Class Encoding

Table of Contents

Constants

COMMAND  = 'c'
OPERATOR  = 'o'
TYPE  = 't'

Properties

$recursionStack  : array<string|int, mixed>
The recursion stack.
$addPositionWhitespace  : bool
$config  : Config|null
$content  : string
$differences  : array<string|int, mixed>
$document  : Document|null
$encoding  : array<string|int, mixed>
$header  : Header
$mapping  : array<string|int, mixed>

Methods

__construct()  : mixed
__toString()  : string
Returns encoding class name if available or empty string (only prior PHP 7.4).
factory()  : self
get()  : Element|PDFObject|Header
getCommandsText()  : array<string|int, mixed>
getCommandsText() expects the content of $text_part to be an already formatted, single-line command from a document stream.
getConfig()  : Config|null
getContent()  : string|null
getDetails()  : array<string|int, mixed>
getDocument()  : Document
getHeader()  : Header|null
getText()  : string
Returns the text content of a PDF as a string. Attempts to add whitespace for spacing and line-breaks where appropriate.
getTextArray()  : array<string|int, mixed>
Returns the text content of a PDF as an array of strings. No extra whitespace is inserted besides what is actually encoded in the PDF text.
has()  : bool
init()  : mixed
translateChar()  : int|null
getEncodingClass()  : string
getUniqueId()  : string
Returns unique id identifying the object.

Constants

Properties

$recursionStack

The recursion stack.

public static array<string|int, mixed> $recursionStack = []

$addPositionWhitespace

protected bool $addPositionWhitespace = false

$differences

protected array<string|int, mixed> $differences

$encoding

protected array<string|int, mixed> $encoding

$mapping

protected array<string|int, mixed> $mapping

Methods

__construct()

public __construct(Document $document[, Header|null $header = null ][, string|null $content = null ][, Config|null $config = null ]) : mixed
Parameters
$document : Document
$header : Header|null = null
$content : string|null = null
$config : Config|null = null

__toString()

Returns encoding class name if available or empty string (only prior PHP 7.4).

public __toString() : string
Tags
throws
Exception

On PHP 7.4+ an exception is thrown if encoding class doesn't exist.

Return values
string

factory()

public static factory(Document $document, Header $header, string|null $content[, Config|null $config = null ]) : self
Parameters
$document : Document
$header : Header
$content : string|null
$config : Config|null = null
Return values
self

getCommandsText()

getCommandsText() expects the content of $text_part to be an already formatted, single-line command from a document stream.

public getCommandsText(string $text_part[, int &$offset = 0 ]) : array<string|int, mixed>

The companion function getSectionsText() returns a document stream as an array of single commands for just this purpose. Because of this, the argument $offset is no longer used, and may be removed in a future PdfParser release.

A better name for this function would be getCommandText() since it now always works on just one command.

Parameters
$text_part : string
$offset : int = 0
Return values
array<string|int, mixed>

getContent()

public getContent() : string|null
Return values
string|null

getDetails()

public getDetails([bool $deep = true ]) : array<string|int, mixed>
Parameters
$deep : bool = true
Return values
array<string|int, mixed>

getText()

Returns the text content of a PDF as a string. Attempts to add whitespace for spacing and line-breaks where appropriate.

public getText([Page|null $page = null ]) : string

getText() leverages getTextArray() to get the content of the document, setting the addPositionWhitespace flag to true so whitespace is inserted in a logical way for reading by humans.

Parameters
$page : Page|null = null
Return values
string

getTextArray()

Returns the text content of a PDF as an array of strings. No extra whitespace is inserted besides what is actually encoded in the PDF text.

public getTextArray([Page|null $page = null ]) : array<string|int, mixed>
Parameters
$page : Page|null = null
Tags
throws
Exception
Return values
array<string|int, mixed>

has()

public has(string $name) : bool
Parameters
$name : string
Return values
bool

translateChar()

public translateChar(mixed $dec) : int|null
Parameters
$dec : mixed
Return values
int|null

getUniqueId()

Returns unique id identifying the object.

protected getUniqueId() : string
Return values
string

        
On this page

Search results