Contao Utils Bundle

AbstractPdfCreator
in package

AbstractYes

Class AbstractPdfCreator.

PdfCreator was moved into it's own bundle (heimrichhannot/pdf-creator)

Table of Contents

Constants

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]

Properties

$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
$margins  : array<string|int, mixed>|null
$mediaType  : string|null
$orientation  : string|null
$outputMode  : string|null
$templateFilePath  : string|null

Methods

addFont()  : $this
getBeforeCreateInstanceCallback()  : callable|null
getBeforeOutputPdfCallback()  : callable|null
getFilename()  : string
getFolder()  : string|null
getFonts()  : array<string|int, mixed>|null
getFormat()  : string|null
getHtmlContent()  : mixed
getMargins()  : array<string|int, mixed>|null
getMediaType()  : string|null
getOrientation()  : string|null
getOutputMode()  : string
getSupportedOutputModes()  : array<string|int, mixed>
getTemplateFilePath()  : string|null
getType()  : string
Return an unique type alias.
render()  : void
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
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.

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()

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

getMargins()

public getMargins() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|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

getType()

Return an unique type alias.

public abstract static getType() : string
Return values
string

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

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

        
On this page

Search results