Index
-
\setasign\SetaPDF2
-
Core
-
Type
- AbstractType
- BypassSecHandlerInterface
- Dictionary
- Exception
- IndirectObjectInterface
- IndirectReference
- OwnerInterface
- PdfArray
- PdfBoolean
- PdfCallback
- PdfDictionary
- PdfHexString
- PdfIndirectObject
- PdfIndirectReference
- PdfName
- PdfNull
- PdfNumeric
- PdfObjectStream
- PdfRaw
- PdfScalarValueInterface
- PdfStream
- PdfString
- PdfStringInterface
- PdfToken
-
Type
-
Core
setasign\SetaPDF2\Core\Type
PdfObjectStream Class representing an object stream object.
File: /SetaPDF v2/Core/Type/PdfObjectStream.php
Old class name (alias):
\SetaPDF_Core_Type_ObjectStream
Class hierarchy
Implements
- \SplObserver
- \SplSubject
- \setasign\SetaPDF2\Core\Canvas\StreamProxyInterface
- BypassSecHandlerInterface
- OwnerInterface
- \setasign\SetaPDF2\Core\Writer\WriteInterface
Summary
Methods
- __construct()
- __sleep()
- _applyFilter()
- _decrypt()
- _getBeforeSaveCallbackName()
- _getObjectOffset()
- _getParser()
- _getUnfilteredStream()
- _preProcess()
- addObject()
- appendStream()
- attach()
- cleanUp()
- clear()
- deepClone()
- detach()
- detachAll()
- ensure()
- getIndirectObject()
- getOffsets()
- getOwner()
- getOwnerPdfDocument()
- getStream()
- getValue()
- hasCryptFilter()
- isNew()
- isObserved()
- isValid()
- notify()
- processObjects()
- resolveIndirectObject()
- setBypassSecHandler()
- setOwner()
- setStream()
- setValue()
- toPdfString()
- toPhp()
- unfilterStream()
- update()
- write()
- writeTo()
Properties
$_isNew
Flag telling whether this object stream is a newly created one or read from an existing stream.
$_observers
The Objects to notify on any change
This will be the PDF document or another value holding this one. Initially this will be an array.
$_owner
The document instance to which this object stream belongs to.
$_parser
The stream parser instance.
$_unfilteredStream
The unfiltered stream content
$_valid
Defines if a inner object had triggered a change to invalid the state of this object stream.
$_value
The dictionary of the stream object
Static Methods
_ensureType()
mixed $value,
string $errorMessage,
$ensure = true
Ensure that a value is an instance of a specific PDF type.
Parameters
- $type : string
- $value : mixed
- $errorMessage : string
- $ensure
Exceptions
Throws Exception
create()
Parameters
- $document : \SetaPDF_Core_Document
ensureType()
Ensures that the passed value is a PdfObjectStream instance.
Parameters
- $stream : mixed
Exceptions
Throws Exception
ensureWithType()
mixed $value
Ensures that the passed value is an instance of the passed type.
Parameters
- $type : string
- $value : mixed
Exceptions
Throws Exception
is()
Checks if the type of a value is the expected one.
Indirect references will be evaluated if $ensure
is set to true
.
Parameters
- $type : string
- $value : mixed
- $ensure : bool
writePdfString()
Parses a php value to a pdf string and writes it into a writer.
PHP data type -> PDF data type
Null -> PdfNull
Boolean -> PdfBoolean
Integer/Double -> PdfNumeric
String -> PdfString or PdfName(if the string starts with "/")
Indexed array -> PdfArray
Associative array -> PdfDictionary
Parameters
- $writer : \SetaPDF_Core_WriteInterface
- $value : mixed
Exceptions
Throws \InvalidArgumentException
Methods
__construct()
string $stream = '',
?\SetaPDF_Core_Type_IndirectObject $owningObject = null
The constructor.
Parameters
- $value : ?\SetaPDF_Core_Type_Dictionary
- $stream : string
- $owningObject : ?\SetaPDF_Core_Type_IndirectObject
__sleep()
Implementation of __sleep.
We remove the observers from all elements because they will get read if they are waked up in an observed object.
_applyFilter()
Applies filter to the stream.
Parameters
- $stream : string
- $encode : bool
- $pdfDocument : ?\SetaPDF_Core_Document
The document, on which the stream will get used. This value is only needed for a crypt filter (to be implemented!)
Exceptions
Throws \setasign\SetaPDF2\Exception
_getObjectOffset()
Get the offset value for a specific object id.
Parameters
- $objectId : int
Exceptions
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws Exception
Throws \setasign\SetaPDF2\Exception
_getParser()
Get the stream parser.
Exceptions
Throws \setasign\SetaPDF2\Core\Reader\Exception
Throws Exception
Throws \setasign\SetaPDF2\Exception
_getUnfilteredStream()
A proxy method to hold a copy of the unfiltered stream.
Exceptions
Throws \setasign\SetaPDF2\Exception
_preProcess()
Pre-Process the stream for the output in a specific PDF document.
Parameters
- $pdfDocument : \SetaPDF_Core_Document
addObject()
attach()
Add an observer to the object.
Implementation of the Observer Pattern.
Parameters
- $observer : \SplObserver
deepClone()
Clone the object recursively in the context of a document.
Parameters
- $document : \SetaPDF_Core_Document
detach()
Detach an observer from the object.
Implementation of the Observer Pattern.
Parameters
- $observer : \SplObserver
ensure()
array &$ensuredObjectsList = array ( )
Returns the main value.
This method is used for automatically resolving of indirect references.
Parameters
- $forceObservation : ?bool
- $ensuredObjectsList : array
A list of all ensured indirect objects to prevent recursion
getOffsets()
Get the offsets of all objects in this object stream.
Exceptions
Throws Exception
Throws \setasign\SetaPDF2\Exception
getStream()
Get the plain stream content.
Parameters
- $ignoreFaultyStreams : bool
- $filtered : bool
Exceptions
Throws \setasign\SetaPDF2\Exception
hasCryptFilter()
notify()
Notifies all attached observers.
Implementation of the Observer Pattern.
Has to be called by any method that changes a value.
processObjects()
Create the final stream based on the added objects.
Exceptions
Throws Exception
Throws \setasign\SetaPDF2\Exception
resolveIndirectObject()
Resolves an indirect object in this object stream.
Parameters
- $objectId : int
Exceptions
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\Exception
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Core\Reader\Exception
Throws Exception
Throws \setasign\SetaPDF2\Exception
setOwner()
setValue()
Set the PDF dictionary for this stream object.
Parameters
- $value : \SetaPDF_Core_Type_Dictionary
The value
Exceptions
Throws \InvalidArgumentException
See
toPdfString()
update()
Triggered if a value of this object is changed. Forward this to the document in that case.
A stream can only be observed by an indirect object.
So let's check the observers for this type and forward it to its owning document instance. It's hard to tell if the whole object stream should be rewritten or only the single modified object.
Parameters
- $subject : \SplSubject
write()
writeTo()
Writes the type as a formatted PDF string to the document.
Parameters
- $pdfDocument : \SetaPDF_Core_Document