Contao Utils Bundle

PdfWriter extends AbstractPdfWriter
in package

Class PdfWriter.

Use PdfCreatorFactory::createInstance(MpdfCreator::getType()) instead

Table of Contents

Constants

OUTPUT_MODE_DOWNLOAD  = 'download'
OUTPUT_MODE_FILE  = 'file'
OUTPUT_MODE_INLINE  = 'inline'
OUTPUT_MODES  = [self::OUTPUT_MODE_DOWNLOAD, self::OUTPUT_MODE_FILE, self::OUTPUT_MODE_INLINE]

Properties

$config  : array<string|int, mixed>
Pdf configuration.
$fileName  : string
Pdf file name.
$folder  : string
The folder in case of saving to file.
$html  : string
Pdf html content including styles.
$isPrepared  : bool
$pdf  : Mpdf
Current mpdf instance.
$template  : string
Master pdf template.

Methods

__construct()  : mixed
constructor.
addFontDirectories()  : PdfWriter
Add font directories to the config.
generate()  : void
Generate the pdf.
getConfig()  : array<string|int, mixed>
Get the pdf config.
getFileName()  : string
Get the pdf file name.
getFolder()  : string
getHtml()  : string
Get html including styles.
getPdf()  : Mpdf
Get current pdf object.
getTemplate()  : string
Get the master template path.
isPrepared()  : bool
Check if prepare was already triggered.
mergeConfig()  : PdfWriter
Merge current pdf config with given.
prepare()  : Mpdf
Prepare the current mpdf object.
setConfig()  : PdfWriter
Set pdf config, replace default with custom config.
setDefaultConfig()  : mixed
setFileName()  : PdfWriter
Set the pdf filename.
setFolder()  : void
setHtml()  : PdfWriter
Set html including styles.
setTemplate()  : PdfWriter
Set the master template path.

Constants

OUTPUT_MODES

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

Properties

$pdf

Current mpdf instance.

protected Mpdf $pdf

$template

Master pdf template.

protected string $template

Methods

__construct()

constructor.

public __construct() : mixed

addFontDirectories()

Add font directories to the config.

public addFontDirectories(array<string|int, mixed> $paths) : PdfWriter
Parameters
$paths : array<string|int, mixed>

Directory pathseader

Return values
PdfWriter

Current pdf writer instance

generate()

Generate the pdf.

public generate([string $mode = self::OUTPUT_MODE_DOWNLOAD ]) : void
Parameters
$mode : string = self::OUTPUT_MODE_DOWNLOAD

getConfig()

Get the pdf config.

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

getFileName()

Get the pdf file name.

public getFileName() : string
Return values
string

getHtml()

Get html including styles.

public getHtml() : string
Return values
string

getPdf()

Get current pdf object.

public getPdf([bool $init = false ]) : Mpdf
Parameters
$init : bool = false

Set true if you want to create a new pdf regardless there is always an existing pdf

Return values
Mpdf

getTemplate()

Get the master template path.

public getTemplate() : string
Return values
string

isPrepared()

Check if prepare was already triggered.

public isPrepared() : bool
Return values
bool

mergeConfig()

Merge current pdf config with given.

public mergeConfig(array<string|int, mixed> $config) : PdfWriter
Parameters
$config : array<string|int, mixed>
Return values
PdfWriter

Current pdf writer instance

prepare()

Prepare the current mpdf object.

public prepare() : Mpdf
Return values
Mpdf

setConfig()

Set pdf config, replace default with custom config.

public setConfig(array<string|int, mixed> $config) : PdfWriter
Parameters
$config : array<string|int, mixed>
Return values
PdfWriter

Current pdf writer instance

setDefaultConfig()

public setDefaultConfig() : mixed

setFileName()

Set the pdf filename.

public setFileName(string $fileName) : PdfWriter
Parameters
$fileName : string
Return values
PdfWriter

Current pdf writer instance

setFolder()

public setFolder(string $folder) : void
Parameters
$folder : string

setTemplate()

Set the master template path.

public setTemplate(string $template) : PdfWriter
Parameters
$template : string
Return values
PdfWriter

Current pdf writer instance


        
On this page

Search results