setasign\SetaPDF2\Core\Document\Page

Contents A class representing a pages content

File: /SetaPDF v2/Core/Document/Page/Contents.php
Old class name (alias): \SetaPDF_Core_Document_Page_Contents

Class hierarchy

Implements

Summary

Properties

$_currentOffset

protected int Contents::$_currentOffset

The current content stream offset

$_currentStream

The current active content stream

$_encapsulatedInGraphicState

protected bool Contents::$_encapsulatedInGraphicState = false

Flag saying if the content is already encapsulated in a graphic state

$_page

The page object to which this helper instance depends on


Methods

__construct()

The constructor.

Parameters
$page : \SetaPDF_Core_Document_Page
 

_addStream()

protected Contents::_addStream (
?int $beforeIndex,
bool $setActive = true,
?\SetaPDF_Core_Type_IndirectObjectInterface $streamObject = null
): \SetaPDF_Core_Type_IndirectObjectInterface

Method for adding streams to the Contents entry.

Parameters
$beforeIndex : ?int
 
$setActive : bool
 
$streamObject : ?\SetaPDF_Core_Type_IndirectObjectInterface
 
Exceptions

Throws \setasign\SetaPDF2\Core\Type\Exception

cleanUp()

public Contents::cleanUp (
void
): void

Release memory/resources.

clear()

public Contents::clear (
void
): void

Clears the stream object.

count()

public Contents::count (
void
): int

Gets the count of contents streams available for this page.

encapsulateExistingContentInGraphicState()

public Contents::encapsulateExistingContentInGraphicState (
bool $force = false
): void

Encapsulate the existing content stream(s) in separate graphic state operators.

Parameters
$force : bool
 
Exceptions

Throws \setasign\SetaPDF2\Core\Type\Exception

getLastStreamObject()

public Contents::getLastStreamObject (
bool $create = false,
bool $setActive = true
): bool|\SetaPDF_Core_Type_Stream

Get and/or create the last stream.

Parameters
$create : bool
 
$setActive : bool
 
Exceptions

Throws \setasign\SetaPDF2\Core\Type\Exception

getStream()

public Contents::getStream (
bool $ignoreFaultyStreams = false
): string

Get the stream content.

Parameters
$ignoreFaultyStreams : bool
 

getStreamObject()

public Contents::getStreamObject (
bool $create = false
): bool|\SetaPDF_Core_Type_Stream

Get the stream object.

Parameters
$create : bool
 
Exceptions

Throws \setasign\SetaPDF2\Core\Type\Exception

getStreamObjectByOffset()

public Contents::getStreamObjectByOffset (
int $offset = 0,
bool $setActive = true
): bool|\SetaPDF_Core_Type_Stream

Get a stream by offset in the contents array.

Parameters
$offset : int
 
$setActive : bool
 

isLastStreamActive()

public Contents::isLastStreamActive (
void
): bool

Checks if the last content stream is active.

prependStream()

Prepend a stream to the beginning of the Contents array.

Parameters
$setActive : bool
 
$streamObject : ?\SetaPDF_Core_Type_IndirectObjectInterface
 
Exceptions

Throws \setasign\SetaPDF2\Core\Type\Exception

pushStream()

Append a stream to the end of the Contents array.

Parameters
$setActive : bool
 
$streamObject : ?\SetaPDF_Core_Type_IndirectObjectInterface
 
Exceptions

Throws \setasign\SetaPDF2\Core\Type\Exception

write()

public Contents::write (
string $bytes
): void

Writes a string to the stream object.

Parameters
$bytes : string
 
Exceptions

Throws \setasign\SetaPDF2\Core\Type\Exception