expMPDF6
extends expMPDF
in package
This is the class expMPDF6 a wrapper for using mPDF v6.1
Tags
Table of Contents
- $pdf : mixed
- Private use variables.
- $PDF_ASSTRING : mixed
- Returns the PDF file as a string.
- $PDF_DOWNLOAD : mixed
- Force the client to download PDF file.
- $PDF_EMBEDDED : mixed
- When possible, force the client to embed (display) PDF file.
- $PDF_LANDSCAPE : mixed
- PDF generated as landscape (horizontal).
- $PDF_PORTRAIT : mixed
- PDF generated as landscape (vertical).
- $PDF_SAVEFILE : mixed
- PDF file is saved into the server space. The path is returned.
- $orient : mixed
- $size : mixed
- __construct() : mixed
- Constructor: initialize a pdf file file.
- __get() : null
- Generic magic method
- __isset() : bool
- Generic magic method
- __set() : mixed
- Generic magic method We MUST create/set non-existing properties for Exponent code to work
- __unset() : mixed
- Generic magic method
- createpdf() : string|bool
- Render and Return PDF using various options.
- installed() : mixed
- Return status of pdf engine being installed correctly
- output() : string
- Return PDF as a string.
- render() : mixed
- Convert HTML to PDF.
- set_grayscale() : mixed
- set_html() : mixed
- Set html content.
- set_html_file() : mixed
- Set html content by file.
- set_orientation() : mixed
- Set orientation, use constants from this class.
- set_page_size() : mixed
- Set page/paper size.
- set_paper() : mixed
- Set page/paper size.
- stream() : mixed
- Streams the PDF to the client.
Properties
Private use variables.
public
mixed
$pdf
= \null
$PDF_ASSTRING
Returns the PDF file as a string.
public
static mixed
$PDF_ASSTRING
= 'S'
$PDF_DOWNLOAD
Force the client to download PDF file.
public
static mixed
$PDF_DOWNLOAD
= 'D'
$PDF_EMBEDDED
When possible, force the client to embed (display) PDF file.
public
static mixed
$PDF_EMBEDDED
= 'I'
$PDF_LANDSCAPE
PDF generated as landscape (horizontal).
public
static mixed
$PDF_LANDSCAPE
= 'landscape'
$PDF_PORTRAIT
PDF generated as landscape (vertical).
public
static mixed
$PDF_PORTRAIT
= 'portrait'
$PDF_SAVEFILE
PDF file is saved into the server space. The path is returned.
public
static mixed
$PDF_SAVEFILE
= 'F'
$orient
protected
mixed
$orient
= 'portrait'
$size
protected
mixed
$size
= \HTMLTOPDF_PAPER
Methods
__construct()
Constructor: initialize a pdf file file.
public
__construct([string $paper_size = HTMLTOPDF_PAPER ][, string $orientation = "portrait" ][, string $html = null ][, bool $use_file = false ]) : mixed
Parameters
- $paper_size : string = HTMLTOPDF_PAPER
-
page size
- $orientation : string = "portrait"
-
page orientation
- $html : string = null
-
html code for page
- $use_file : bool = false
-
a flag to show $html is an html file location to be loaded
Return values
mixed —__get()
Generic magic method
public
__get( $property) : null
Parameters
Return values
null —__isset()
Generic magic method
public
__isset( $property) : bool
Parameters
Return values
bool —__set()
Generic magic method We MUST create/set non-existing properties for Exponent code to work
public
__set( $property, $value) : mixed
Parameters
Return values
mixed —__unset()
Generic magic method
public
__unset( $property) : mixed
Parameters
Return values
mixed —createpdf()
Render and Return PDF using various options.
public
createpdf(string $mode, string $file) : string|bool
Parameters
- $mode : string
-
How to output (constants from this same class).
- $file : string
-
The PDF's filename (the usage depends on $mode.
Return values
string|bool —Depending on $mode, this may be success (boolean) or PDF (string).
installed()
Return status of pdf engine being installed correctly
public
static installed() : mixed
Return values
mixed —output()
Return PDF as a string.
public
output([int $compress = null ]) : string
Parameters
- $compress : int = null
-
compress the output
Return values
string —render()
Convert HTML to PDF.
public
render() : mixed
Return values
mixed —set_grayscale()
public
set_grayscale(mixed $mode) : mixed
Parameters
- $mode : mixed
Return values
mixed —set_html()
Set html content.
public
set_html(string $html) : mixed
Parameters
- $html : string
-
New html content. It replaces any previous content.
Return values
mixed —set_html_file()
Set html content by file.
public
set_html_file(string $htmlfile) : mixed
Parameters
- $htmlfile : string
-
the html file to use
Return values
mixed —set_orientation()
Set orientation, use constants from this class.
public
set_orientation(string $orientation) : mixed
By default orientation is portrait.
Parameters
- $orientation : string
-
orientation of paper
Return values
mixed —set_page_size()
Set page/paper size.
public
set_page_size(string $size) : mixed
Parameters
- $size : string
-
Formal paper size (eg; A4, letter...)
Return values
mixed —set_paper()
Set page/paper size.
public
set_paper(string $size[, string $orientation = 'portrait' ]) : mixed
Parameters
- $size : string
-
Formal paper size (eg; A4, letter...)
- $orientation : string = 'portrait'
-
orientation of paper
Return values
mixed —stream()
Streams the PDF to the client.
public
stream(string $filename[, array<string|int, mixed> $options = null ]) : mixed
Parameters
- $filename : string
-
the pdf file to output
- $options : array<string|int, mixed> = null
-
options 'compress' = > 1 or 0 - apply content stream compression, this is on (1) by default ◦ 'Attachment' => 1 or 0 - if 1, force the browser to open a download dialog, on (1) by default