PHP Класс kartik\mpdf\Pdf

С версии: 1.0
Автор: Kartik Visweswaran ([email protected])
Наследование: extends yii\base\Component
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$content the HTML content to be converted to PDF
$cssFile css file to prepend to the PDF
$cssInline additional inline css to append after the cssFile
$defaultFont sets the default font-family for the new document. Uses default value set in defaultCSS unless codepage has been set to "win-1252". If codepage="win-1252", the appropriate core Adobe font will be set i.e. Helvetica, Times, or Courier.
$defaultFontSize sets the default document font size in points (pt)
$destination the output destination
$filename the output filename
$format
$marginBottom sets the page bottom margin for the new document (in millimetres).
$marginFooter sets the page footer margin for the new document (in millimetres).
$marginHeader sets the page header margin for the new document (in millimetres).
$marginLeft sets the page left margin for the new document. All values should be specified as LENGTH in millimetres. If you are creating a DOUBLE-SIDED document, the margin values specified will be used for ODD pages; left and right margins will be mirrored for EVEN pages.
$marginRight sets the page right margin for the new document (in millimetres).
$marginTop sets the page top margin for the new document (in millimetres).
$methods the mPDF methods that will called in the sequence listed before rendering the content. Should be an associative array of $method => $params format, where: - $method: string, is the mPDF method / function name - $param: mixed, are the mPDF method parameters
$mode specifies the mode of the new document. If the mode is set by passing a country/language string, this may also set: available fonts, text justification, and directionality RTL.
$options the mPDF configuration options entered as a $key => value associative array, where: - $key: string is the mPDF configuration property name - $value: mixed is the mPDF configured property value
$orientation specifies the default page orientation of the new document.
$tempPath the folder path for storing the temporary data generated by mpdf. If not set this defaults to Yii::getAlias('@runtime/mpdf').

Защищенные свойства (Protected)

Свойство Тип Описание
$_css the css file content
$_mpdf api instance
$_pdfAttachements Array of file-pathes that should be attached to the generated PDF

Открытые методы

Метод Описание
addPdfAttachement ( string $filePath ) add an PDF to attach to the generated PDF
configure ( $options = [] ) Configures mPDF options
execute ( $method, $params = [] ) : mixed Calls the mPDF method with parameters
getApi ( ) : mPDF Initializes (if needed) and fetches the mPDF API instance
getCss ( ) : string Fetches the content of the CSS file if supplied
getPdfAttachements ( ) : array
init ( )
initTempPaths ( ) Initialize folder paths to allow mpdf to write temporary data.
output ( $content = '', $file = '', $dest = self::DEST_BROWSER ) : mixed Generates a PDF output
render ( ) Renders and returns the PDF output. Uses the class level property settings.
setApi ( ) Sets the mPDF API instance

Защищенные методы

Метод Описание
definePath ( string $prop, string $dir ) : boolean Defines a mPDF temporary path if not set
parseFormat ( ) Parse the format automatically based on the orientation

Приватные методы

Метод Описание
writePdfAttachement ( mPDF $api, String $attachement ) appends the given attachement to the generated PDF

Описание методов

addPdfAttachement() публичный Метод

add an PDF to attach to the generated PDF
public addPdfAttachement ( string $filePath )
$filePath string

configure() публичный Метод

Configures mPDF options
public configure ( $options = [] )

definePath() защищенный статический Метод

Defines a mPDF temporary path if not set
protected static definePath ( string $prop, string $dir ) : boolean
$prop string the mPDF constant to define
$dir string the directory to create
Результат boolean

execute() публичный Метод

Calls the mPDF method with parameters
public execute ( $method, $params = [] ) : mixed
Результат mixed

getApi() публичный Метод

Initializes (if needed) and fetches the mPDF API instance
public getApi ( ) : mPDF
Результат mPDF instance

getCss() публичный Метод

Fetches the content of the CSS file if supplied
public getCss ( ) : string
Результат string

getPdfAttachements() публичный Метод

public getPdfAttachements ( ) : array
Результат array Array of attachements

init() публичный Метод

public init ( )

initTempPaths() публичный Метод

Initialize folder paths to allow mpdf to write temporary data.
public initTempPaths ( )

output() публичный Метод

Generates a PDF output
public output ( $content = '', $file = '', $dest = self::DEST_BROWSER ) : mixed
Результат mixed

parseFormat() защищенный Метод

Parse the format automatically based on the orientation
protected parseFormat ( )

render() публичный Метод

Renders and returns the PDF output. Uses the class level property settings.
public render ( )

setApi() публичный Метод

Sets the mPDF API instance
public setApi ( )

Описание свойств

$_css защищенное свойство

the css file content
protected $_css

$_mpdf защищенное свойство

api instance
protected $_mpdf

$_pdfAttachements защищенное свойство

Array of file-pathes that should be attached to the generated PDF
protected $_pdfAttachements

$content публичное свойство

the HTML content to be converted to PDF
public $content

$cssFile публичное свойство

css file to prepend to the PDF
public $cssFile

$cssInline публичное свойство

additional inline css to append after the cssFile
public $cssInline

$defaultFont публичное свойство

sets the default font-family for the new document. Uses default value set in defaultCSS unless codepage has been set to "win-1252". If codepage="win-1252", the appropriate core Adobe font will be set i.e. Helvetica, Times, or Courier.
public $defaultFont

$defaultFontSize публичное свойство

sets the default document font size in points (pt)
public $defaultFontSize

$destination публичное свойство

the output destination
public $destination

$filename публичное свойство

the output filename
public $filename

$format публичное свойство

public $format

$marginBottom публичное свойство

sets the page bottom margin for the new document (in millimetres).
public $marginBottom

$marginFooter публичное свойство

sets the page footer margin for the new document (in millimetres).
public $marginFooter

$marginHeader публичное свойство

sets the page header margin for the new document (in millimetres).
public $marginHeader

$marginLeft публичное свойство

sets the page left margin for the new document. All values should be specified as LENGTH in millimetres. If you are creating a DOUBLE-SIDED document, the margin values specified will be used for ODD pages; left and right margins will be mirrored for EVEN pages.
public $marginLeft

$marginRight публичное свойство

sets the page right margin for the new document (in millimetres).
public $marginRight

$marginTop публичное свойство

sets the page top margin for the new document (in millimetres).
public $marginTop

$methods публичное свойство

the mPDF methods that will called in the sequence listed before rendering the content. Should be an associative array of $method => $params format, where: - $method: string, is the mPDF method / function name - $param: mixed, are the mPDF method parameters
public $methods

$mode публичное свойство

specifies the mode of the new document. If the mode is set by passing a country/language string, this may also set: available fonts, text justification, and directionality RTL.
public $mode

$options публичное свойство

the mPDF configuration options entered as a $key => value associative array, where: - $key: string is the mPDF configuration property name - $value: mixed is the mPDF configured property value
public $options

$orientation публичное свойство

specifies the default page orientation of the new document.
public $orientation

$tempPath публичное свойство

the folder path for storing the temporary data generated by mpdf. If not set this defaults to Yii::getAlias('@runtime/mpdf').
public $tempPath