ObjectStream
extends PdfStream
in package
Object stream (/Type /ObjStm) — ISO 32000-2 §7.5.7.
A PDF 1.5+ container that holds multiple indirect objects as a single compressed stream. The stream body is laid out as:
<objNum_1> <offset_1> <objNum_2> <offset_2> ... <objNum_N> <offset_N> <obj_1><obj_2>...<obj_N>
First is the byte offset at which the first contained object begins
(i.e. the length of the header pair sequence). Contained objects are
serialized without obj/endobj wrappers.
Only objects without streams and not themselves compressed may be packed.
Attributes
- #[RequiresPdfVersion]
- \Phpdftk\Pdf\Core\PdfVersion::V1_5
Table of Contents
Constants
- PDF_TYPE = 'ObjStm'
Properties
- $data : string
- $dictionary : PdfDictionary
- $extends : PdfReference|null
- Optional /Extends reference to a parent object stream.
- $generationNumber : int
- $objectNumber : int
Methods
- __construct() : mixed
- addObject() : void
- Add an indirect object to the stream. The object must have been assigned an object number already. The object's `toPdf()` output is packed verbatim — `obj`/`endobj` framing is stripped by ObjStm rules.
- count() : int
- Number of objects packed in this stream (/N).
- setFilter() : void
- Set a filter to encode/decode the stream data.
- toIndirectObject() : string
- Wrap the object in an indirect object structure: X Y obj ... endobj
- toPdf() : string
- Returns the stream body: dictionary, stream keyword, data, endstream.
Constants
PDF_TYPE
public
mixed
PDF_TYPE
= 'ObjStm'
Properties
$data
public
string
$data
= ''
$dictionary
public
PdfDictionary
$dictionary
$extends
Optional /Extends reference to a parent object stream.
public
PdfReference|null
$extends
= null
$generationNumber
public
int
$generationNumber
= 0
$objectNumber
public
int
$objectNumber
= 0
Methods
__construct()
public
__construct() : mixed
addObject()
Add an indirect object to the stream. The object must have been assigned an object number already. The object's `toPdf()` output is packed verbatim — `obj`/`endobj` framing is stripped by ObjStm rules.
public
addObject(PdfObject $object) : void
Parameters
- $object : PdfObject
count()
Number of objects packed in this stream (/N).
public
count() : int
Return values
intsetFilter()
Set a filter to encode/decode the stream data.
public
setFilter(FilterInterface $filter, string $pdfFilterName) : void
Parameters
- $filter : FilterInterface
-
The filter implementation
- $pdfFilterName : string
-
The PDF filter name (e.g. 'FlateDecode', 'ASCII85Decode')
toIndirectObject()
Wrap the object in an indirect object structure: X Y obj ... endobj
public
toIndirectObject() : string
Return values
stringtoPdf()
Returns the stream body: dictionary, stream keyword, data, endstream.
public
toPdf() : string
/Length is injected into the dictionary at serialization time. If a filter is set, the data is encoded before writing.