AbstractCompiler
in package
implements
CompilerInterface
Abstract Pdf compiler class
Tags
Table of Contents
Interfaces
- CompilerInterface
- Compiler interface
Properties
- $byteLength : int|null
- PDF byte length
- $compression : bool
- Compression property
- $document : Document|null
- Document object
- $fontReferences : array<string|int, mixed>
- Font references
- $fonts : array<string|int, mixed>
- Fonts array
- $info : InfoObject|null
- Info object
- $lastIndex : int
- Highest object index currently stored in $objects. Maintained incrementally (via addObject()) so that lastIndex() is O(1) instead of re-scanning/sorting the entire, ever-growing $objects array.
- $objects : array<string|int, mixed>
- Objects array
- $output : string|null
- PDF document output buffer
- $pages : array<string|int, mixed>
- Pages array
- $parent : ParentObject|null
- Parent object
- $root : RootObject|null
- Root object
- $trailer : string|null
- PDF document trailer
Methods
- finalize() : void
- Compile and finalize the PDF document
- getDocument() : Document|null
- Get the document object
- getFontReferences() : array<string|int, mixed>
- Get the font references
- getFonts() : array<string|int, mixed>
- Get the fonts
- getInfo() : InfoObject|null
- Get the info object
- getObjects() : array<string|int, mixed>
- Get the compiled objects
- getOutput() : string
- Get the compiled output
- getParent() : ParentObject|null
- Get the parent object
- getRoot() : RootObject|null
- Get the root object
- lastIndex() : int
- Return the last object index.
- prepareFonts() : void
- Prepare the font objects
- setDocument() : Compiler
- Set the document object
- addObject() : AbstractCompiler
- Add an object to the objects array, keeping the cached last index (returned by lastIndex()) in sync. Objects are not guaranteed to be added in strictly ascending index order (e.g. imported/merged objects), so the cached index is updated via a running max rather than a blind increment.
- calculateByteLength() : int
- Calculate byte length
- formatByteLength() : string
- Format byte length
- getCoordinates() : array<string|int, mixed>
- Get coordinates based on document origin
- prepareAnnotations() : void
- Prepare the annotation objects
- prepareImages() : void
- Prepare the image objects
- preparePaths() : void
- Prepare the path objects
- prepareText() : void
- Prepare the text objects
- setInfo() : AbstractCompiler
- Set the info object
- setParent() : AbstractCompiler
- Set the parent object
- setRoot() : AbstractCompiler
- Set the root object
Properties
$byteLength
PDF byte length
protected
int|null
$byteLength
= null
$compression
Compression property
protected
bool
$compression
= true
$document
Document object
protected
Document|null
$document
= null
$fontReferences
Font references
protected
array<string|int, mixed>
$fontReferences
= []
$fonts
Fonts array
protected
array<string|int, mixed>
$fonts
= []
$info
Info object
protected
InfoObject|null
$info
= null
$lastIndex
Highest object index currently stored in $objects. Maintained incrementally (via addObject()) so that lastIndex() is O(1) instead of re-scanning/sorting the entire, ever-growing $objects array.
protected
int
$lastIndex
= 0
$objects
Objects array
protected
array<string|int, mixed>
$objects
= []
$output
PDF document output buffer
protected
string|null
$output
= null
$pages
Pages array
protected
array<string|int, mixed>
$pages
= []
$parent
Parent object
protected
ParentObject|null
$parent
= null
$root
Root object
protected
RootObject|null
$root
= null
$trailer
PDF document trailer
protected
string|null
$trailer
= null
Methods
finalize()
Compile and finalize the PDF document
public
abstract finalize([Document|null $document = null ]) : void
Parameters
- $document : Document|null = null
getDocument()
Get the document object
public
getDocument() : Document|null
Return values
Document|nullgetFontReferences()
Get the font references
public
getFontReferences() : array<string|int, mixed>
Return values
array<string|int, mixed>getFonts()
Get the fonts
public
getFonts() : array<string|int, mixed>
Return values
array<string|int, mixed>getInfo()
Get the info object
public
getInfo() : InfoObject|null
Return values
InfoObject|nullgetObjects()
Get the compiled objects
public
getObjects() : array<string|int, mixed>
Return values
array<string|int, mixed>getOutput()
Get the compiled output
public
getOutput() : string
Return values
stringgetParent()
Get the parent object
public
getParent() : ParentObject|null
Return values
ParentObject|nullgetRoot()
Get the root object
public
getRoot() : RootObject|null
Return values
RootObject|nulllastIndex()
Return the last object index.
public
lastIndex() : int
Return values
intprepareFonts()
Prepare the font objects
public
abstract prepareFonts() : void
setDocument()
Set the document object
public
abstract setDocument(Document $document) : Compiler
Parameters
- $document : Document
Return values
CompileraddObject()
Add an object to the objects array, keeping the cached last index (returned by lastIndex()) in sync. Objects are not guaranteed to be added in strictly ascending index order (e.g. imported/merged objects), so the cached index is updated via a running max rather than a blind increment.
protected
addObject(int|string|null $index, ObjectInterface $object) : AbstractCompiler
Parameters
- $index : int|string|null
- $object : ObjectInterface
Return values
AbstractCompilercalculateByteLength()
Calculate byte length
protected
calculateByteLength(Stringable|string|null $string) : int
Parameters
- $string : Stringable|string|null
Return values
intformatByteLength()
Format byte length
protected
formatByteLength(int|string $num) : string
Parameters
- $num : int|string
Return values
stringgetCoordinates()
Get coordinates based on document origin
protected
getCoordinates(int|float $x, int|float $y, PageObject $pageObject) : array<string|int, mixed>
Parameters
- $x : int|float
- $y : int|float
- $pageObject : PageObject
Return values
array<string|int, mixed>prepareAnnotations()
Prepare the annotation objects
protected
abstract prepareAnnotations(array<string|int, mixed> $annotations, PageObject $pageObject) : void
Parameters
- $annotations : array<string|int, mixed>
- $pageObject : PageObject
prepareImages()
Prepare the image objects
protected
abstract prepareImages(array<string|int, mixed> $images, PageObject $pageObject) : void
Parameters
- $images : array<string|int, mixed>
- $pageObject : PageObject
preparePaths()
Prepare the path objects
protected
abstract preparePaths(array<string|int, mixed> $paths, PageObject $pageObject) : void
Parameters
- $paths : array<string|int, mixed>
- $pageObject : PageObject
prepareText()
Prepare the text objects
protected
abstract prepareText(array<string|int, mixed> $text, PageObject $pageObject) : void
Parameters
- $text : array<string|int, mixed>
- $pageObject : PageObject
setInfo()
Set the info object
protected
setInfo(InfoObject $info) : AbstractCompiler
Parameters
- $info : InfoObject
Return values
AbstractCompilersetParent()
Set the parent object
protected
setParent(ParentObject $parent) : AbstractCompiler
Parameters
- $parent : ParentObject
Return values
AbstractCompilersetRoot()
Set the root object
protected
setRoot(RootObject $root) : AbstractCompiler
Parameters
- $root : RootObject