Chromium
extends Base
in package
Chromium driver class for PDF generation.
Table of Contents
- DRIVER_NAME = 'LBL_CHROMIUM_PDF'
- MM_TO_IN = 0.0393701
- MM_TO_PX = 3.7795275591
- PAGE_FORMATS = [ // ISO 216 A Series + 2 SIS 014711 extensions 'A0' => [33.11, 46.81], // = ( 841 x 1189 ) mm = ( 33.11 x 46.81 ) in 'A1' => [23.39, 33.11], // = ( 594 x 841 ) mm = ( 23.39 x 33.11 ) in 'A2' => [16.54, 23.39], // = ( 420 x 594 ) mm = ( 16.54 x 23.39 ) in 'A3' => [11.69, 16.54], // = ( 297 x 420 ) mm = ( 11.69 x 16.54 ) in 'A4' => [8.27, 11.69], // = ( 210 x 297 ) mm = ( 8.27 x 11.69 ) in 'A5' => [5.83, 8.27], // = ( 148 x 210 ) mm = ( 5.83 x 8.27 ) in 'A6' => [4.13, 5.83], // = ( 105 x 148 ) mm = ( 4.13 x 5.83 ) in 'A7' => [2.91, 4.13], // = ( 74 x 105 ) mm = ( 2.91 x 4.13 ) in 'A8' => [2.05, 2.91], // = ( 52 x 74 ) mm = ( 2.05 x 2.91 ) in 'A9' => [1.46, 2.05], // = ( 37 x 52 ) mm = ( 1.46 x 2.05 ) in 'A10' => [1.02, 1.46], // = ( 26 x 37 ) mm = ( 1.02 x 1.46 ) in // ISO 216 B Series + 2 SIS 014711 extensions 'B0' => [39.37, 55.67], // = ( 1000 x 1414 ) mm = ( 39.37 x 55.67 ) in 'B1' => [27.83, 39.37], // = ( 707 x 1000 ) mm = ( 27.83 x 39.37 ) in 'B2' => [19.69, 27.83], // = ( 500 x 707 ) mm = ( 19.69 x 27.83 ) in 'B3' => [13.9, 19.69], // = ( 353 x 500 ) mm = ( 13.90 x 19.69 ) in 'B4' => [9.84, 13.9], // = ( 250 x 353 ) mm = ( 9.84 x 13.90 ) in 'B5' => [6.93, 9.84], // = ( 176 x 250 ) mm = ( 6.93 x 9.84 ) in 'B6' => [4.92, 6.93], // = ( 125 x 176 ) mm = ( 4.92 x 6.93 ) in 'B7' => [3.46, 4.92], // = ( 88 x 125 ) mm = ( 3.46 x 4.92 ) in 'B8' => [2.44, 3.46], // = ( 62 x 88 ) mm = ( 2.44 x 3.46 ) in 'B9' => [1.73, 2.44], // = ( 44 x 62 ) mm = ( 1.73 x 2.44 ) in 'B10' => [1.22, 1.73], // = ( 31 x 44 ) mm = ( 1.22 x 1.73 ) in // ISO 216 C Series + 2 SIS 014711 extensions + 5 EXTENSION 'C0' => [36.1, 51.06], // = ( 917 x 1297 ) mm = ( 36.10 x 51.06 ) in 'C1' => [25.51, 36.1], // = ( 648 x 917 ) mm = ( 25.51 x 36.10 ) in 'C2' => [18.03, 25.51], // = ( 458 x 648 ) mm = ( 18.03 x 25.51 ) in 'C3' => [12.76, 18.03], // = ( 324 x 458 ) mm = ( 12.76 x 18.03 ) in 'C4' => [9.02, 12.76], // = ( 229 x 324 ) mm = ( 9.02 x 12.76 ) in 'C5' => [6.38, 9.02], // = ( 162 x 229 ) mm = ( 6.38 x 9.02 ) in 'C6' => [4.49, 6.38], // = ( 114 x 162 ) mm = ( 4.49 x 6.38 ) in 'C7' => [3.19, 4.49], // = ( 81 x 114 ) mm = ( 3.19 x 4.49 ) in 'C8' => [2.24, 3.19], // = ( 57 x 81 ) mm = ( 2.24 x 3.19 ) in 'C9' => [1.57, 2.24], // = ( 40 x 57 ) mm = ( 1.57 x 2.24 ) in 'C10' => [1.1, 1.57], // = ( 28 x 40 ) mm = ( 1.10 x 1.57 ) in // ISO Press 'RA0' => [33.86, 48.03], // = ( 860 x 1220 ) mm = ( 33.86 x 48.03 ) in 'RA1' => [24.02, 33.86], // = ( 610 x 860 ) mm = ( 24.02 x 33.86 ) in 'RA2' => [16.93, 24.02], // = ( 430 x 610 ) mm = ( 16.93 x 24.02 ) in 'RA3' => [12.01, 16.93], // = ( 305 x 430 ) mm = ( 12.01 x 16.93 ) in 'RA4' => [8.460000000000001, 12.01], // = ( 215 x 305 ) mm = ( 8.46 x 12.01 ) in 'SRA0' => [35.43, 50.39], // = ( 900 x 1280 ) mm = ( 35.43 x 50.39 ) in 'SRA1' => [25.2, 35.43], // = ( 640 x 900 ) mm = ( 25.20 x 35.43 ) in 'SRA2' => [17.72, 25.2], // = ( 450 x 640 ) mm = ( 17.72 x 25.20 ) in 'SRA3' => [12.6, 17.72], // = ( 320 x 450 ) mm = ( 12.60 x 17.72 ) in 'SRA4' => [8.859999999999999, 12.6], // = ( 225 x 320 ) mm = ( 8.86 x 12.60 ) in // German DIN 476 '4A0' => [66.22, 93.62], // = ( 1682 x 2378 ) mm = ( 66.22 x 93.62 ) in '2A0' => [46.81, 66.22], // = ( 1189 x 1682 ) mm = ( 46.81 x 66.22 ) in // Traditional 'Loose' North American Paper Sizes 'LETTER' => [8.5, 11.0], // = ( 216 x 279 ) mm = ( 8.50 x 11.00 ) in 'LEGAL' => [8.5, 14.0], // = ( 216 x 356 ) mm = ( 8.50 x 14.00 ) in 'LEDGER' => [17.0, 11.0], // = ( 432 x 279 ) mm = ( 17.00 x 11.00 ) in 'TABLOID' => [11.0, 17.0], // = ( 279 x 432 ) mm = ( 11.00 x 17.00 ) in 'EXECUTIVE' => [7.25, 10.5], // = ( 184 x 267 ) mm = ( 7.25 x 10.50 ) in 'FOLIO' => [8.5, 13.0], // = ( 216 x 330 ) mm = ( 8.50 x 13.00 ) in 'B' => [5.04, 7.8], // = ( 128 x 198 ) mm = ( 5.04 x 7.80 ) in 'A' => [4.37, 7.0], // = ( 111 x 178 ) mm = ( 4.37 x 7.00 ) in 'DEMY' => [8.5, 5.31], // = ( 135 x 216 ) mm = ( 8.50 x 5.31 ) in 'ROYAL' => [6.02, 9.210000000000001], ]
- WATERMARK_TYPE_IMAGE = 1
- WATERMARK_TYPE_TEXT = 0
- $defaultMargins : array<string|int, mixed>
- $body : string
- $charset : string
- $fileName : string
- $font : string
- $fontSize : int
- $footer : string
- $footerMargin : int
- $header : string
- $headerMargin : int
- $pdf : ProcessAwareBrowser
- $pdfHtml : string
- $pdfOptions : array<string|int, mixed>
- $template : Vtiger_PDF_Model
- $watermark : string
- __construct() : mixed
- Constructor.
- getBody() : string
- Get HTML body content.
- getFileName() : string
- Get pdf filename.
- getInputCharset() : string
- Get input charset.
- getTemplate() : Vtiger_PDF_Model
- Get PDF template model.
- isActive() : bool
- Check if the driver is active.
- loadTemplateData() : void
- Load template data to PDF instance.
- loadWatermark() : $this
- Load watermark.
- output() : void
- Output content to PDF.
- parseParams() : $this
- Parse and set options.
- setAuthor() : $this
- Set Title of the document.
- setBody() : $this
- Set HTML body content for exporting to PDF.
- setBottomMargin() : $this
- Set bottom margin.
- setCreator() : $this
- Set Title of the document.
- setFileName() : $this
- Set pdf filename.
- setFont() : $this
- Set font.
- setFooter() : $this
- Set footer content.
- setFooterMargin() : $this
- Set footer margin.
- setHeader() : $this
- Set header content.
- setHeaderMargin() : $this
- Set header margin.
- setInputCharset() : $this
- Set input charset.
- setKeywords() : $this
- Set Title of the document.
- setLeftMargin() : $this
- Set left margin.
- setMargins() : $this
- Set document margins.
- setPageSize() : $this
- Set page size and orientation.
- setRightMargin() : $this
- Set right margin.
- setSubject() : $this
- Set Title of the document.
- setTemplate() : $this
- Set PDF template model.
- setTitle() : $this
- Set Title of the document.
- setTopMargin() : $this
- Set top margin.
- wrapFooterContent() : string
- Wrap footer content.
- wrapHeaderContent() : string
- Wrap header content.
- wrapWatermark() : string
- Wrap watermark.
- writeHTML() : $this
- Write html.
- getPdfHtml() : string
- Get PDF HTML.
- getPdfOptions() : array<string|int, mixed>
- Get PDF options.
- wrapContent() : string
- Wrap body content.
Constants
DRIVER_NAME
public
string
DRIVER_NAME
= 'LBL_CHROMIUM_PDF'
Driver name
MM_TO_IN
public
float
MM_TO_IN
= 0.0393701
Millimeter to inch converter
MM_TO_PX
public
float
MM_TO_PX
= 3.7795275591
Millimeter to pixel converter
PAGE_FORMATS
public
mixed
PAGE_FORMATS
= [
// ISO 216 A Series + 2 SIS 014711 extensions
'A0' => [33.11, 46.81],
// = ( 841 x 1189 ) mm = ( 33.11 x 46.81 ) in
'A1' => [23.39, 33.11],
// = ( 594 x 841 ) mm = ( 23.39 x 33.11 ) in
'A2' => [16.54, 23.39],
// = ( 420 x 594 ) mm = ( 16.54 x 23.39 ) in
'A3' => [11.69, 16.54],
// = ( 297 x 420 ) mm = ( 11.69 x 16.54 ) in
'A4' => [8.27, 11.69],
// = ( 210 x 297 ) mm = ( 8.27 x 11.69 ) in
'A5' => [5.83, 8.27],
// = ( 148 x 210 ) mm = ( 5.83 x 8.27 ) in
'A6' => [4.13, 5.83],
// = ( 105 x 148 ) mm = ( 4.13 x 5.83 ) in
'A7' => [2.91, 4.13],
// = ( 74 x 105 ) mm = ( 2.91 x 4.13 ) in
'A8' => [2.05, 2.91],
// = ( 52 x 74 ) mm = ( 2.05 x 2.91 ) in
'A9' => [1.46, 2.05],
// = ( 37 x 52 ) mm = ( 1.46 x 2.05 ) in
'A10' => [1.02, 1.46],
// = ( 26 x 37 ) mm = ( 1.02 x 1.46 ) in
// ISO 216 B Series + 2 SIS 014711 extensions
'B0' => [39.37, 55.67],
// = ( 1000 x 1414 ) mm = ( 39.37 x 55.67 ) in
'B1' => [27.83, 39.37],
// = ( 707 x 1000 ) mm = ( 27.83 x 39.37 ) in
'B2' => [19.69, 27.83],
// = ( 500 x 707 ) mm = ( 19.69 x 27.83 ) in
'B3' => [13.9, 19.69],
// = ( 353 x 500 ) mm = ( 13.90 x 19.69 ) in
'B4' => [9.84, 13.9],
// = ( 250 x 353 ) mm = ( 9.84 x 13.90 ) in
'B5' => [6.93, 9.84],
// = ( 176 x 250 ) mm = ( 6.93 x 9.84 ) in
'B6' => [4.92, 6.93],
// = ( 125 x 176 ) mm = ( 4.92 x 6.93 ) in
'B7' => [3.46, 4.92],
// = ( 88 x 125 ) mm = ( 3.46 x 4.92 ) in
'B8' => [2.44, 3.46],
// = ( 62 x 88 ) mm = ( 2.44 x 3.46 ) in
'B9' => [1.73, 2.44],
// = ( 44 x 62 ) mm = ( 1.73 x 2.44 ) in
'B10' => [1.22, 1.73],
// = ( 31 x 44 ) mm = ( 1.22 x 1.73 ) in
// ISO 216 C Series + 2 SIS 014711 extensions + 5 EXTENSION
'C0' => [36.1, 51.06],
// = ( 917 x 1297 ) mm = ( 36.10 x 51.06 ) in
'C1' => [25.51, 36.1],
// = ( 648 x 917 ) mm = ( 25.51 x 36.10 ) in
'C2' => [18.03, 25.51],
// = ( 458 x 648 ) mm = ( 18.03 x 25.51 ) in
'C3' => [12.76, 18.03],
// = ( 324 x 458 ) mm = ( 12.76 x 18.03 ) in
'C4' => [9.02, 12.76],
// = ( 229 x 324 ) mm = ( 9.02 x 12.76 ) in
'C5' => [6.38, 9.02],
// = ( 162 x 229 ) mm = ( 6.38 x 9.02 ) in
'C6' => [4.49, 6.38],
// = ( 114 x 162 ) mm = ( 4.49 x 6.38 ) in
'C7' => [3.19, 4.49],
// = ( 81 x 114 ) mm = ( 3.19 x 4.49 ) in
'C8' => [2.24, 3.19],
// = ( 57 x 81 ) mm = ( 2.24 x 3.19 ) in
'C9' => [1.57, 2.24],
// = ( 40 x 57 ) mm = ( 1.57 x 2.24 ) in
'C10' => [1.1, 1.57],
// = ( 28 x 40 ) mm = ( 1.10 x 1.57 ) in
// ISO Press
'RA0' => [33.86, 48.03],
// = ( 860 x 1220 ) mm = ( 33.86 x 48.03 ) in
'RA1' => [24.02, 33.86],
// = ( 610 x 860 ) mm = ( 24.02 x 33.86 ) in
'RA2' => [16.93, 24.02],
// = ( 430 x 610 ) mm = ( 16.93 x 24.02 ) in
'RA3' => [12.01, 16.93],
// = ( 305 x 430 ) mm = ( 12.01 x 16.93 ) in
'RA4' => [8.460000000000001, 12.01],
// = ( 215 x 305 ) mm = ( 8.46 x 12.01 ) in
'SRA0' => [35.43, 50.39],
// = ( 900 x 1280 ) mm = ( 35.43 x 50.39 ) in
'SRA1' => [25.2, 35.43],
// = ( 640 x 900 ) mm = ( 25.20 x 35.43 ) in
'SRA2' => [17.72, 25.2],
// = ( 450 x 640 ) mm = ( 17.72 x 25.20 ) in
'SRA3' => [12.6, 17.72],
// = ( 320 x 450 ) mm = ( 12.60 x 17.72 ) in
'SRA4' => [8.859999999999999, 12.6],
// = ( 225 x 320 ) mm = ( 8.86 x 12.60 ) in
// German DIN 476
'4A0' => [66.22, 93.62],
// = ( 1682 x 2378 ) mm = ( 66.22 x 93.62 ) in
'2A0' => [46.81, 66.22],
// = ( 1189 x 1682 ) mm = ( 46.81 x 66.22 ) in
// Traditional 'Loose' North American Paper Sizes
'LETTER' => [8.5, 11.0],
// = ( 216 x 279 ) mm = ( 8.50 x 11.00 ) in
'LEGAL' => [8.5, 14.0],
// = ( 216 x 356 ) mm = ( 8.50 x 14.00 ) in
'LEDGER' => [17.0, 11.0],
// = ( 432 x 279 ) mm = ( 17.00 x 11.00 ) in
'TABLOID' => [11.0, 17.0],
// = ( 279 x 432 ) mm = ( 11.00 x 17.00 ) in
'EXECUTIVE' => [7.25, 10.5],
// = ( 184 x 267 ) mm = ( 7.25 x 10.50 ) in
'FOLIO' => [8.5, 13.0],
// = ( 216 x 330 ) mm = ( 8.50 x 13.00 ) in
'B' => [5.04, 7.8],
// = ( 128 x 198 ) mm = ( 5.04 x 7.80 ) in
'A' => [4.37, 7.0],
// = ( 111 x 178 ) mm = ( 4.37 x 7.00 ) in
'DEMY' => [8.5, 5.31],
// = ( 135 x 216 ) mm = ( 8.50 x 5.31 ) in
'ROYAL' => [6.02, 9.210000000000001],
]
WATERMARK_TYPE_IMAGE
public
string
WATERMARK_TYPE_IMAGE
= 1
Watermark image type
WATERMARK_TYPE_TEXT
public
string
WATERMARK_TYPE_TEXT
= 0
Watermark text type
Properties
$defaultMargins
public
array<string|int, mixed>
$defaultMargins
= ['left' => 30, 'right' => 30, 'top' => 40, 'bottom' => 40, 'header' => 10, 'footer' => 10]
Default margins in mm.
$body
protected
string
$body
HTML body.
$charset
protected
string
$charset
Charset.
$fileName
protected
string
$fileName
File name.
$font
protected
string
$font
= '"Times New Roman", Times, serif'
Default font.
$fontSize
protected
int
$fontSize
= '16px'
Default font size (px).
$footer
protected
string
$footer
HTML footer.
$footerMargin
protected
int
$footerMargin
= 10
Footer margin .
$header
protected
string
$header
HTML header.
$headerMargin
protected
int
$headerMargin
= 10
Header margin.
protected
ProcessAwareBrowser
$pdf
PDF generator instance.
$pdfHtml
protected
string
$pdfHtml
Pdf HTML content.
$pdfOptions
protected
array<string|int, mixed>
$pdfOptions
= []
Pdf options.
$template
protected
Vtiger_PDF_Model
$template
PDF model instance.
$watermark
protected
string
$watermark
HTML watermark.
Methods
__construct()
Constructor.
public
__construct() : mixed
Return values
mixed —getBody()
Get HTML body content.
public
getBody() : string
Return values
string —getFileName()
Get pdf filename.
public
getFileName() : string
Return values
string —getInputCharset()
Get input charset.
public
getInputCharset() : string
Return values
string —getTemplate()
Get PDF template model.
public
getTemplate() : Vtiger_PDF_Model
Return values
Vtiger_PDF_Model —isActive()
Check if the driver is active.
public
static isActive() : bool
Return values
bool —loadTemplateData()
Load template data to PDF instance.
public
loadTemplateData() : void
Return values
void —loadWatermark()
Load watermark.
public
loadWatermark() : $this
Return values
$this —output()
Output content to PDF.
public
output([mixed $fileName = '' ][, mixed $mode = 'D' ]) : void
Parameters
- $fileName : mixed = ''
- $mode : mixed = 'D'
-
Output mode, default:
D
,I
= show in browser ,D
= download ,F
= save to file
Return values
void —parseParams()
Parse and set options.
public
parseParams(array<string|int, mixed> $params) : $this
Parameters
- $params : array<string|int, mixed>
Return values
$this —setAuthor()
Set Title of the document.
public
setAuthor(string $author) : $this
Parameters
- $author : string
Return values
$this —setBody()
Set HTML body content for exporting to PDF.
public
setBody(string $html) : $this
Parameters
- $html : string
Return values
$this —setBottomMargin()
Set bottom margin.
public
setBottomMargin(float $margin) : $this
Parameters
- $margin : float
Return values
$this —setCreator()
Set Title of the document.
public
setCreator(string $creator) : $this
Parameters
- $creator : string
Return values
$this —setFileName()
Set pdf filename.
public
setFileName(string $fileName) : $this
Parameters
- $fileName : string
Return values
$this —setFont()
Set font.
public
setFont(string $family, mixed $size) : $this
Parameters
- $family : string
- $size : mixed
Return values
$this —setFooter()
Set footer content.
public
setFooter(string $footerHtml) : $this
Parameters
- $footerHtml : string
Return values
$this —setFooterMargin()
Set footer margin.
public
setFooterMargin(float $margin) : $this
Parameters
- $margin : float
Return values
$this —setHeader()
Set header content.
public
setHeader(string $headerHtml) : $this
Parameters
- $headerHtml : string
Return values
$this —setHeaderMargin()
Set header margin.
public
setHeaderMargin(float $margin) : $this
Parameters
- $margin : float
Return values
$this —setInputCharset()
Set input charset.
public
setInputCharset(string $charset) : $this
Parameters
- $charset : string
Return values
$this —setKeywords()
Set Title of the document.
public
setKeywords(array<string|int, mixed> $keywords) : $this
Parameters
- $keywords : array<string|int, mixed>
Return values
$this —setLeftMargin()
Set left margin.
public
setLeftMargin(float $margin) : $this
Parameters
- $margin : float
Return values
$this —setMargins()
Set document margins.
public
setMargins(array<string|int, mixed> $margins) : $this
Parameters
- $margins : array<string|int, mixed>
-
['top'=>40,'bottom'=>40,'left'=>30,'right'=>30,'header'=>10,'footer'=>10]
Return values
$this —setPageSize()
Set page size and orientation.
public
setPageSize(string $format[, string $orientation = null ]) : $this
Parameters
- $format : string
- $orientation : string = null
Return values
$this —setRightMargin()
Set right margin.
public
setRightMargin(float $margin) : $this
Parameters
- $margin : float
Return values
$this —setSubject()
Set Title of the document.
public
setSubject(string $subject) : $this
Parameters
- $subject : string
Return values
$this —setTemplate()
Set PDF template model.
public
setTemplate(Vtiger_PDF_Model $template) : $this
Parameters
- $template : Vtiger_PDF_Model
Return values
$this —setTitle()
Set Title of the document.
public
setTitle(string $title) : $this
Parameters
- $title : string
Return values
$this —setTopMargin()
Set top margin.
public
setTopMargin(float $margin) : $this
Parameters
- $margin : float
Return values
$this —wrapFooterContent()
Wrap footer content.
public
wrapFooterContent(string $content) : string
Parameters
- $content : string
Return values
string —wrapHeaderContent()
Wrap header content.
public
wrapHeaderContent(string $content) : string
Parameters
- $content : string
Return values
string —wrapWatermark()
Wrap watermark.
public
wrapWatermark(string $watermarkContent) : string
Parameters
- $watermarkContent : string
Return values
string —writeHTML()
Write html.
public
writeHTML() : $this
Return values
$this —getPdfHtml()
Get PDF HTML.
protected
getPdfHtml() : string
Return values
string —getPdfOptions()
Get PDF options.
protected
getPdfOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —wrapContent()
Wrap body content.
protected
wrapContent(string $content) : string
Parameters
- $content : string