PDFExport
extends PDFExport
in package
Class created by Core/Internal/PluginsDeploy
Table of Contents
Constants
- CONTENT_X = 30
- X position to start writing.
- FONT_SIZE = 9
- Font size.
- FOOTER_Y = 10
- Y position to start footer
- INVOICE_TOTALS_Y = 200
- LIST_LIMIT = 500
- MAX_TITLE_LEN = 12
- Maximum title length
Properties
- $extensionCache : array<string|int, mixed>
- Cache for extension lookups by method name.
- $extensions : array<string|int, mixed>
- Stores class extensions.
- $format : FormatoDocumento
- $i18n : Translator
- Translator object
- $insertedHeader : bool
- $pdf : Cezpdf
- PDF object.
- $tableWidth : int|float
- PDF table width.
Methods
- __call() : mixed
- Executes the first matched extension.
- __construct() : mixed
- PDFExport constructor.
- addBusinessDocPage() : bool
- Adds a new page with the document data.
- addExtension() : void
- addListModelPage() : bool
- Adds a new page with a table listing the model's data.
- addModelPage() : bool
- Adds a new page with the model data.
- addTablePage() : bool
- Adds a new page with the table.
- clearExtensions() : void
- Clears all registered extensions.
- getDoc() : mixed
- Return the full document.
- getExtensions() : array<string|int, mixed>
- Returns a list of all registered extension names.
- getOrientation() : mixed
- hasExtension() : bool
- newDoc() : mixed
- Blank document.
- newPage() : mixed
- Adds a new page.
- pipe() : mixed
- pipeFalse() : bool
- removeExtension() : bool
- Removes all extensions with the specified name.
- setCompany() : void
- setOrientation() : mixed
- Sets default orientation.
- show() : mixed
- Set headers and output document content to response.
- addImageFromAttachedFile() : mixed
- addImageFromFile() : mixed
- calcImageSize() : array<string|int, mixed>
- Calculate image size and return as array of width and height
- combineAddress() : string
- Combine address if the parameters don´t empty
- fixValue() : string
- getBankData() : string
- getColumnAlignments() : array<string|int, mixed>
- getColumnTitles() : array<string|int, mixed>
- getColumnWidgets() : array<string|int, mixed>
- getCountryName() : string
- Gets the name of the country with that code.
- getCursorData() : array<string|int, mixed>
- getCursorRawData() : array<string|int, mixed>
- getDivisaName() : string
- Gets the name of an specify divisa
- getDocAddress() : string
- Returns the combination of the address.
- getDocumentFormat() : FormatoDocumento
- getFileName() : string
- getLineHeaders() : array<string|int, mixed>
- getModelColumnsData() : array<string|int, mixed>
- getModelFields() : array<string|int, mixed>
- getTableData() : array<string|int, mixed>
- Returns the table data
- getTaxesRows() : mixed
- insertBusinessDocBody() : mixed
- Generate the body of the page with the model data.
- insertBusinessDocFooter() : mixed
- Inserts the footer of the page with the model data.
- insertBusinessDocHeader() : mixed
- Inserts the header of the page with the model data.
- insertBusinessDocShipping() : mixed
- Inserts the address of delivery with the model data.
- insertCompanyLogo() : mixed
- Inserts company logo to PDF document or dies with a message to try to solve the problem.
- insertFooter() : mixed
- Insert footer details.
- insertHeader() : mixed
- Insert header details.
- insertInvoicePayMethod() : mixed
- insertInvoiceReceipts() : mixed
- insertParallelTable() : mixed
- Generate a table with two key => value per row.
- newLine() : mixed
- Adds a new line to the PDF.
- newLongTitles() : mixed
- Adds a description of long titles to the PDF.
- parallelTableData() : array<string|int, mixed>
- Returns a new table with 2 columns. Each column with colName1: colName2
- removeEmptyCols() : mixed
- Remove the empty columns to save space.
- removeLongTitles() : mixed
- Adds to $longTitles, and replace all long titles from $titles
- renderQRimage() : void
- renderQRtext() : void
- setFileName() : mixed
- setTableColumns() : mixed
- Set the table content.
- buildExtensionCache() : void
- Builds and caches sorted extensions for a method name.
Constants
CONTENT_X
X position to start writing.
public
mixed
CONTENT_X
= 30
FONT_SIZE
Font size.
public
mixed
FONT_SIZE
= 9
FOOTER_Y
Y position to start footer
public
mixed
FOOTER_Y
= 10
INVOICE_TOTALS_Y
public
mixed
INVOICE_TOTALS_Y
= 200
LIST_LIMIT
public
mixed
LIST_LIMIT
= 500
MAX_TITLE_LEN
Maximum title length
public
mixed
MAX_TITLE_LEN
= 12
Properties
$extensionCache
Cache for extension lookups by method name.
protected
static array<string|int, mixed>
$extensionCache
= []
$extensions
Stores class extensions.
protected
static array<string|int, mixed>
$extensions
= []
$format
protected
FormatoDocumento
$format
$i18n
Translator object
protected
Translator
$i18n
$insertedHeader
protected
bool
$insertedHeader
= false
PDF object.
protected
Cezpdf
$pdf
$tableWidth
PDF table width.
protected
int|float
$tableWidth
= 0.0
Methods
__call()
Executes the first matched extension.
public
__call(string $name[, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
- $name : string
- $arguments : array<string|int, mixed> = []
Tags
__construct()
PDFExport constructor.
public
__construct() : mixed
addBusinessDocPage()
Adds a new page with the document data.
public
addBusinessDocPage(BusinessDocument $model) : bool
Parameters
- $model : BusinessDocument
Return values
booladdExtension()
public
static addExtension(mixed $extension[, int $priority = 100 ]) : void
Parameters
- $extension : mixed
- $priority : int = 100
-
Priority for all methods in this extension (0-1000, default 100)
addListModelPage()
Adds a new page with a table listing the model's data.
public
addListModelPage(ModelClass $model, array<string|int, DataBaseWhere> $where, array<string|int, mixed> $order, int $offset, array<string|int, mixed> $columns[, string $title = '' ]) : bool
Parameters
- $model : ModelClass
- $where : array<string|int, DataBaseWhere>
- $order : array<string|int, mixed>
- $offset : int
- $columns : array<string|int, mixed>
- $title : string = ''
Return values
booladdModelPage()
Adds a new page with the model data.
public
addModelPage(ModelClass $model, array<string|int, mixed> $columns[, string $title = '' ]) : bool
Parameters
- $model : ModelClass
- $columns : array<string|int, mixed>
- $title : string = ''
Return values
booladdTablePage()
Adds a new page with the table.
public
addTablePage(array<string|int, mixed> $headers, array<string|int, mixed> $rows[, array<string|int, mixed> $options = [] ][, string $title = '' ]) : bool
Parameters
- $headers : array<string|int, mixed>
- $rows : array<string|int, mixed>
- $options : array<string|int, mixed> = []
- $title : string = ''
Return values
boolclearExtensions()
Clears all registered extensions.
public
static clearExtensions() : void
getDoc()
Return the full document.
public
getDoc() : mixed
getExtensions()
Returns a list of all registered extension names.
public
static getExtensions() : array<string|int, mixed>
Return values
array<string|int, mixed>getOrientation()
public
getOrientation() : mixed
hasExtension()
public
hasExtension(mixed $name) : bool
Parameters
- $name : mixed
Return values
boolnewDoc()
Blank document.
public
newDoc(string $title, int $idformat, string $langcode) : mixed
Parameters
- $title : string
- $idformat : int
- $langcode : string
newPage()
Adds a new page.
public
newPage([string $orientation = 'portrait' ][, bool $forceNewPage = false ]) : mixed
Parameters
- $orientation : string = 'portrait'
- $forceNewPage : bool = false
pipe()
public
pipe(string $name, array<string|int, mixed> ...$arguments) : mixed
Parameters
- $name : string
- $arguments : array<string|int, mixed>
pipeFalse()
public
pipeFalse(string $name, array<string|int, mixed> ...$arguments) : bool
Parameters
- $name : string
- $arguments : array<string|int, mixed>
Return values
boolremoveExtension()
Removes all extensions with the specified name.
public
static removeExtension(string $name) : bool
Parameters
- $name : string
Return values
bool —True if at least one extension was removed
setCompany()
public
setCompany(int $idempresa) : void
Parameters
- $idempresa : int
setOrientation()
Sets default orientation.
public
setOrientation(string $orientation) : mixed
Parameters
- $orientation : string
show()
Set headers and output document content to response.
public
show(Response &$response) : mixed
Parameters
- $response : Response
addImageFromAttachedFile()
protected
addImageFromAttachedFile(AttachedFile $file, int|float $xPos, int|float $yPos, int|float $width, int|float $height) : mixed
Parameters
- $file : AttachedFile
- $xPos : int|float
- $yPos : int|float
- $width : int|float
- $height : int|float
addImageFromFile()
protected
addImageFromFile(string $filePath, int|float $xPos, int|float $yPos, int|float $width, int|float $height) : mixed
Parameters
- $filePath : string
- $xPos : int|float
- $yPos : int|float
- $width : int|float
- $height : int|float
calcImageSize()
Calculate image size and return as array of width and height
protected
calcImageSize(string $filePath) : array<string|int, mixed>
Parameters
- $filePath : string
Return values
array<string|int, mixed>combineAddress()
Combine address if the parameters don´t empty
protected
combineAddress(BusinessDocument|Contacto $model) : string
Parameters
- $model : BusinessDocument|Contacto
Return values
stringfixValue()
protected
fixValue(string $value) : string
Parameters
- $value : string
Return values
stringgetBankData()
protected
getBankData(BusinessDocument|ReciboCliente $receipt) : string
Parameters
- $receipt : BusinessDocument|ReciboCliente
Return values
stringgetColumnAlignments()
protected
getColumnAlignments(array<string|int, mixed> $columns) : array<string|int, mixed>
Parameters
- $columns : array<string|int, mixed>
Return values
array<string|int, mixed>getColumnTitles()
protected
getColumnTitles(array<string|int, mixed> $columns) : array<string|int, mixed>
Parameters
- $columns : array<string|int, mixed>
Return values
array<string|int, mixed>getColumnWidgets()
protected
getColumnWidgets(array<string|int, mixed> $columns) : array<string|int, mixed>
Parameters
- $columns : array<string|int, mixed>
Return values
array<string|int, mixed>getCountryName()
Gets the name of the country with that code.
protected
getCountryName(string $code) : string
Parameters
- $code : string
Return values
stringgetCursorData()
protected
getCursorData(array<string|int, ModelClass> $cursor, array<string|int, mixed> $columns) : array<string|int, mixed>
Parameters
- $cursor : array<string|int, ModelClass>
- $columns : array<string|int, mixed>
Return values
array<string|int, mixed>getCursorRawData()
protected
getCursorRawData(array<string|int, ModelClass> $cursor[, array<string|int, mixed> $fields = [] ]) : array<string|int, mixed>
Parameters
- $cursor : array<string|int, ModelClass>
- $fields : array<string|int, mixed> = []
Return values
array<string|int, mixed>getDivisaName()
Gets the name of an specify divisa
protected
getDivisaName(string $code) : string
Parameters
- $code : string
Return values
stringgetDocAddress()
Returns the combination of the address.
protected
getDocAddress(Cliente|Proveedor $subject, BusinessDocument|Contacto $model) : string
If it is a supplier invoice, it returns the supplier's default address. If it is a customer invoice, return the invoice address
Parameters
- $subject : Cliente|Proveedor
- $model : BusinessDocument|Contacto
Return values
stringgetDocumentFormat()
protected
getDocumentFormat(BusinessDocument $model) : FormatoDocumento
Parameters
- $model : BusinessDocument
Return values
FormatoDocumentogetFileName()
protected
getFileName() : string
Return values
stringgetLineHeaders()
protected
getLineHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>getModelColumnsData()
protected
getModelColumnsData(mixed $model, array<string|int, mixed> $columns) : array<string|int, mixed>
Parameters
- $model : mixed
- $columns : array<string|int, mixed>
Return values
array<string|int, mixed>getModelFields()
protected
getModelFields(ModelClass $model) : array<string|int, mixed>
Parameters
- $model : ModelClass
Return values
array<string|int, mixed>getTableData()
Returns the table data
protected
getTableData(array<string|int, mixed> $cursor, array<string|int, mixed> $tableCols, array<string|int, mixed> $tableOptions) : array<string|int, mixed>
Parameters
- $cursor : array<string|int, mixed>
- $tableCols : array<string|int, mixed>
- $tableOptions : array<string|int, mixed>
Return values
array<string|int, mixed>getTaxesRows()
protected
getTaxesRows(BusinessDocument $model) : mixed
Parameters
- $model : BusinessDocument
insertBusinessDocBody()
Generate the body of the page with the model data.
protected
insertBusinessDocBody(BusinessDocument $model) : mixed
Parameters
- $model : BusinessDocument
insertBusinessDocFooter()
Inserts the footer of the page with the model data.
protected
insertBusinessDocFooter(BusinessDocument $model) : mixed
Parameters
- $model : BusinessDocument
insertBusinessDocHeader()
Inserts the header of the page with the model data.
protected
insertBusinessDocHeader(BusinessDocument $model) : mixed
Parameters
- $model : BusinessDocument
insertBusinessDocShipping()
Inserts the address of delivery with the model data.
protected
insertBusinessDocShipping(BusinessDocument $model) : mixed
Parameters
- $model : BusinessDocument
insertCompanyLogo()
Inserts company logo to PDF document or dies with a message to try to solve the problem.
protected
insertCompanyLogo([int $idfile = 0 ]) : mixed
Parameters
- $idfile : int = 0
insertFooter()
Insert footer details.
protected
insertFooter() : mixed
insertHeader()
Insert header details.
protected
insertHeader([int $idempresa = null ]) : mixed
Parameters
- $idempresa : int = null
insertInvoicePayMethod()
protected
insertInvoicePayMethod(FacturaCliente $invoice) : mixed
Parameters
- $invoice : FacturaCliente
insertInvoiceReceipts()
protected
insertInvoiceReceipts(FacturaCliente $invoice) : mixed
Parameters
- $invoice : FacturaCliente
insertParallelTable()
Generate a table with two key => value per row.
protected
insertParallelTable(array<string|int, mixed> $tableData[, string $title = '' ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $tableData : array<string|int, mixed>
- $title : string = ''
- $options : array<string|int, mixed> = []
newLine()
Adds a new line to the PDF.
protected
newLine() : mixed
newLongTitles()
Adds a description of long titles to the PDF.
protected
newLongTitles(array<string|int, mixed> &$titles, array<string|int, mixed> $columns) : mixed
Parameters
- $titles : array<string|int, mixed>
- $columns : array<string|int, mixed>
parallelTableData()
Returns a new table with 2 columns. Each column with colName1: colName2
protected
parallelTableData(array<string|int, mixed> $table[, string $colName1 = 'key' ][, string $colName2 = 'value' ][, string $finalColName1 = 'data1' ][, string $finalColName2 = 'data2' ]) : array<string|int, mixed>
Parameters
- $table : array<string|int, mixed>
- $colName1 : string = 'key'
- $colName2 : string = 'value'
- $finalColName1 : string = 'data1'
- $finalColName2 : string = 'data2'
Return values
array<string|int, mixed>removeEmptyCols()
Remove the empty columns to save space.
protected
removeEmptyCols(array<string|int, mixed> &$tableData, array<string|int, mixed> &$tableColsTitle[, mixed $customEmptyValue = '0' ]) : mixed
Parameters
- $tableData : array<string|int, mixed>
- $tableColsTitle : array<string|int, mixed>
- $customEmptyValue : mixed = '0'
removeLongTitles()
Adds to $longTitles, and replace all long titles from $titles
protected
removeLongTitles(array<string|int, mixed> &$longTitles, array<string|int, mixed> &$titles) : mixed
Parameters
- $longTitles : array<string|int, mixed>
- $titles : array<string|int, mixed>
renderQRimage()
protected
renderQRimage(string|null $qrImage, string|null $qrTitle, string|null $qrSubtitle, float $startX, float $startY, float $leftBlockWidth, float $rightBlockWidth) : void
Parameters
- $qrImage : string|null
- $qrTitle : string|null
- $qrSubtitle : string|null
- $startX : float
- $startY : float
- $leftBlockWidth : float
- $rightBlockWidth : float
renderQRtext()
protected
renderQRtext(string|null $qrTitle, float $qrX, float $qrY, float $qrSize[, bool $title = true ]) : void
Parameters
- $qrTitle : string|null
- $qrX : float
- $qrY : float
- $qrSize : float
- $title : bool = true
setFileName()
protected
setFileName(string $name) : mixed
Parameters
- $name : string
setTableColumns()
Set the table content.
protected
setTableColumns(array<string|int, mixed> &$columns, array<string|int, mixed> &$tableCols, array<string|int, mixed> &$tableColsTitle, array<string|int, mixed> &$tableOptions) : mixed
Parameters
- $columns : array<string|int, mixed>
- $tableCols : array<string|int, mixed>
- $tableColsTitle : array<string|int, mixed>
- $tableOptions : array<string|int, mixed>
buildExtensionCache()
Builds and caches sorted extensions for a method name.
private
buildExtensionCache(string $name) : void
Parameters
- $name : string