PDF Creator

AbstractPdfCreator
in package

Table of Contents

FONT_STYLE_BOLD  = 'bold'
FONT_STYLE_BOLDITALIC  = 'bolditalic'
FONT_STYLE_ITALIC  = 'italic'
FONT_STYLE_REGUALAR  = 'regular'
ORIENTATION_LANDSCAPE  = 'landscape'
ORIENTATION_PORTRAIT  = 'portrait'
OUTPUT_MODE_DOWNLOAD  = 'download'
OUTPUT_MODE_FILE  = 'file'
OUTPUT_MODE_INLINE  = 'inline'
OUTPUT_MODE_STRING  = 'string'
OUTPUT_MODES  = [self::OUTPUT_MODE_DOWNLOAD, self::OUTPUT_MODE_FILE, self::OUTPUT_MODE_INLINE, self::OUTPUT_MODE_STRING]
SUPPORT_FONTS  = 'fonts'
SUPPORT_MARGINS  = 'margins'
SUPPORT_MASTERTEMPLATE  = 'mastertemplate'
SUPPORT_PSR_LOGGING  = 'psr_logging'
$beforeCreateInstanceCallback  : callable|null
$beforeOutputPdfCallback  : callable|null
$filename  : string|null
$folder  : string|null
$fonts  : array<string|int, mixed>|null
$format  : array<string|int, mixed>|string|null
$htmlContent  : string|null
$logger  : LoggerInterface|null
$margins  : array<string|int, mixed>|null
$mediaType  : string|null
$orientation  : string|null
$outputMode  : string|null
$templateFilePath  : string|null
$tmpPath  : string|null
addFont()  : $this
Register a font file to the pdf. Should be ttf.
getBeforeCreateInstanceCallback()  : callable|null
getBeforeOutputPdfCallback()  : callable|null
getFilename()  : string
getFolder()  : string|null
getFonts()  : array<string|int, mixed>|null
getFormat()  : array<string|int, mixed>|string|null
getHtmlContent()  : mixed
getLogger()  : LoggerInterface|null
getMargins()  : array<string|int, mixed>|null
getMediaType()  : string|null
getOrientation()  : string|null
getOutputMode()  : string
getSupportedOutputModes()  : array<string|int, mixed>
getTemplateFilePath()  : string|null
getTempPath()  : string|null
Get temp folder path. Default system tmp folder.
getType()  : string
Return an unique type alias.
isSupported()  : bool
isUsable()  : bool
Check if all prerequisites for this bundle are fullfilled, typically check for installed libraries.
render()  : PdfCreatorResult
Render the pdf file.
setBeforeCreateInstanceCallback()  : self
Add an callback to modify constructor parameters for pdf library.
setBeforeOutputPdfCallback()  : self
Add an callback to modify the configuration or parameters before outputting the pdf file.
setFilename()  : self
setFolder()  : self
Absolute folder where to store pdf.
setFonts()  : self
setFormat()  : $this
Set the document format.
setHtmlContent()  : self
setLogger()  : self
Add a logger to the pdf library, if supported.
setMargins()  : self
Set document margins.
setMediaType()  : self
setOrientation()  : self
Set orientation. Use AbstractPdfCreator::ORIENTATION_LANDSCAPE or AbstractPdfCreator::ORIENTATION_PORTRAIT.
setOutputMode()  : self
setTemplateFilePath()  : self
Set the absolute path to a pdf template file.
setTempPath()  : self
Set a temp folder path.
supports()  : array<string|int, string>
Output if the library supports specific features.

Constants

OUTPUT_MODES

public mixed OUTPUT_MODES = [self::OUTPUT_MODE_DOWNLOAD, self::OUTPUT_MODE_FILE, self::OUTPUT_MODE_INLINE, self::OUTPUT_MODE_STRING]

Properties

$beforeCreateInstanceCallback

protected callable|null $beforeCreateInstanceCallback

Methods

addFont()

Register a font file to the pdf. Should be ttf.

public addFont(string $filepath, string $family, string $style, string $weight) : $this
Parameters
$filepath : string

Absolute filepath to the font file

$family : string

Font family name

$style : string

Font style (regular, italic, ...), see AbstractPdfCreator::FONT_STYLE constants

$weight : string

Font weight

Return values
$this

getBeforeCreateInstanceCallback()

public getBeforeCreateInstanceCallback() : callable|null
Return values
callable|null

getBeforeOutputPdfCallback()

public getBeforeOutputPdfCallback() : callable|null
Return values
callable|null

getFonts()

public getFonts() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getFormat()

public getFormat() : array<string|int, mixed>|string|null
Return values
array<string|int, mixed>|string|null

getLogger()

public getLogger() : LoggerInterface|null
Return values
LoggerInterface|null

getMargins()

public getMargins() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getMediaType()

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

getOrientation()

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

getSupportedOutputModes()

public abstract getSupportedOutputModes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTemplateFilePath()

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

getTempPath()

Get temp folder path. Default system tmp folder.

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

getType()

Return an unique type alias.

public abstract static getType() : string
Return values
string

isSupported()

public isSupported(string $feature) : bool
Parameters
$feature : string
Return values
bool

isUsable()

Check if all prerequisites for this bundle are fullfilled, typically check for installed libraries.

public abstract static isUsable([bool $triggerExeption = false ]) : bool
Parameters
$triggerExeption : bool = false
Tags
throws
MissingDependenciesException
Return values
bool

setBeforeCreateInstanceCallback()

Add an callback to modify constructor parameters for pdf library.

public setBeforeCreateInstanceCallback(callable|null $beforeCreateInstanceCallback) : self

Callback gets an BeforeCreateLibraryInstanceCallback object as parameter and should return an BeforeCreateLibraryInstanceCallback object.

Parameters
$beforeCreateInstanceCallback : callable|null
Return values
self

setBeforeOutputPdfCallback()

Add an callback to modify the configuration or parameters before outputting the pdf file.

public setBeforeOutputPdfCallback(callable|null $beforeOutputPdfCallback) : self

Callback gets an BeforeOutputPdfCallback object as parameter and should return an BeforeOutputPdfCallback object.

Parameters
$beforeOutputPdfCallback : callable|null
Return values
self

setFilename()

public setFilename(string $filename) : self
Parameters
$filename : string
Return values
self

setFolder()

Absolute folder where to store pdf.

public setFolder(string $folder) : self
Parameters
$folder : string
Return values
self

setFonts()

public setFonts(array<string|int, mixed> $fonts) : self
Parameters
$fonts : array<string|int, mixed>
Return values
self

setFormat()

Set the document format.

public setFormat(string|array<string|int, mixed> $format) : $this
Parameters
$format : string|array<string|int, mixed>

A format type like A4, A5, Letter, Legal,... or an array of integers (width and height in mm).

Return values
$this

setHtmlContent()

public setHtmlContent(mixed $htmlContent) : self
Parameters
$htmlContent : mixed
Return values
self

setLogger()

Add a logger to the pdf library, if supported.

public setLogger(LoggerInterface|null $logger) : self
Parameters
$logger : LoggerInterface|null
Return values
self

setMargins()

Set document margins.

public setMargins(int|null $top[, int|null $right = null ][, int|null $bottom = null ][, int|null $left = null ]) : self
Parameters
$top : int|null
$right : int|null = null
$bottom : int|null = null
$left : int|null = null
Return values
self

setMediaType()

public setMediaType(string|null $mediaType) : self
Parameters
$mediaType : string|null
Return values
self

setOrientation()

Set orientation. Use AbstractPdfCreator::ORIENTATION_LANDSCAPE or AbstractPdfCreator::ORIENTATION_PORTRAIT.

public setOrientation(string $orientation) : self
Parameters
$orientation : string
Return values
self

setOutputMode()

public setOutputMode(string $outputMode) : self
Parameters
$outputMode : string
Return values
self

setTemplateFilePath()

Set the absolute path to a pdf template file.

public setTemplateFilePath(string|null $templateFilePath) : self
Parameters
$templateFilePath : string|null
Return values
self

setTempPath()

Set a temp folder path.

public setTempPath(string|null $tmpPath) : self
Parameters
$tmpPath : string|null
Return values
self

supports()

Output if the library supports specific features.

public supports() : array<string|int, string>
Return values
array<string|int, string>

Search results