Pdf
extends FPDF
in package
Pdf Class
Tags
Table of Contents
- $B : mixed
- $css : mixed
- $cssClass : mixed
- $fontSize : mixed
- $I : mixed
- $lastBlock : mixed
- $lineHeight : int
- $link : mixed
- $U : mixed
- $unit : mixed
- __construct() : mixed
- Create FPDF for Thai language.
- Cell() : mixed
- Output a cell
- Ln() : mixed
- Line break.
- MultiCell() : mixed
- Output text with automatic or explicit line breaks.
- SetCssClass() : mixed
- Set the style attributes for a class.
- SetStyles() : mixed
- Set the style of a tag.
- WriteHTML() : mixed
- Create a PDF from HTML code.
- applyCSS() : mixed
- Apply CSS styles to the document.
- calculateColumnsWidth() : array<string|int, mixed>
- Calculate the width of columns as a percentage.
- calculateSize() : int
- Calculate the size.
- CheckPageBreak() : mixed
- Check the height of a table. If the height exceeds the page, start a new page.
- colorToRGb() : array<string|int, mixed>
- Convert HTML hex color value, e.g., #FF0000, to RGB color value.
- drawHr() : void
- Draw a horizontal line.
- drawImg() : mixed
- Draw an image.
- drawTable() : mixed
- Draws a table.
- loadStyle() : mixed
- Loads the CSS of a node.
- NbLines() : int
- Calculate the height of a cell.
- render() : void
- Renders a node.
- resizeImage() : array<string|int, mixed>
- Resizes an image.
- restoredCSS() : mixed
- Restores CSS properties for a given DOMNode.
- sd() : float
- calculate standard deviation
- SetStyle() : mixed
- Set bold, italic, or underline style for rendering text.
Properties
$B
protected
mixed
$B
$css
protected
mixed
$css
$cssClass
protected
mixed
$cssClass
$fontSize
protected
mixed
$fontSize
$I
protected
mixed
$I
$lastBlock
protected
mixed
$lastBlock
= true
$lineHeight
protected
int
$lineHeight
= 5
$link
protected
mixed
$link
= null
$U
protected
mixed
$U
$unit
protected
mixed
$unit
Methods
__construct()
Create FPDF for Thai language.
public
__construct([string $orientation = 'P' ][, string $unit = 'mm' ][, string $size = 'A4' ][, int $fontSize = 10 ]) : mixed
Parameters
- $orientation : string = 'P'
- $unit : string = 'mm'
- $size : string = 'A4'
- $fontSize : int = 10
Return values
mixed —Cell()
Output a cell
public
Cell(int $w, int $h[, string $txt = '' ], int|string $border, int $ln[, string $align = '' ][, bool $fill = false ][, string $link = '' ], int $tPadding, int $rPadding, int $bPadding, int $lPadding) : mixed
Parameters
- $w : int
-
Width of the cell (automatically calculated if set to 0)
- $h : int
-
Line height
- $txt : string = ''
-
Text to be displayed
- $border : int|string
-
Border style: 0 (no border), 1 (all sides), LTRB (custom sides)
- $ln : int
-
Position after drawing: 0 (to the right) (default), 1 (start of next line), 2 (below)
- $align : string = ''
-
Text alignment: L (left align) (default), R (right align), C (center), J (justify)
- $fill : bool = false
-
Fill color: true (background color), false (transparent)
- $link : string = ''
-
URL link
- $tPadding : int
-
Top padding
- $rPadding : int
-
Right padding
- $bPadding : int
-
Bottom padding
- $lPadding : int
-
Left padding
Return values
mixed —Ln()
Line break.
public
Ln([int $h = null ]) : mixed
Parameters
- $h : int = null
-
line-height. If not specified, the last used value is used.
Return values
mixed —MultiCell()
Output text with automatic or explicit line breaks.
public
MultiCell(int $w, int $h, string $s, int|string $border[, string $align = 'J' ][, bool $fill = false ], int $tPadding, int $rPadding, int $bPadding, int $lPadding) : mixed
Parameters
- $w : int
-
Width. Automatically calculated if set to 0.
- $h : int
-
Line-height.
- $s : string
-
Text to display.
- $border : int|string
-
Border style. 0 for no border, 1 for border on all sides, LTRB for custom sides.
- $align : string = 'J'
-
Alignment. L (or empty) for left-aligned, R for right-aligned, C for center, J for justified (default).
- $fill : bool = false
-
true to display background, false for transparent.
- $tPadding : int
-
Top padding.
- $rPadding : int
-
Right padding.
- $bPadding : int
-
Bottom padding.
- $lPadding : int
-
Left padding.
Return values
mixed —SetCssClass()
Set the style attributes for a class.
public
SetCssClass(string $className, array<string|int, mixed> $attributes) : mixed
Parameters
- $className : string
- $attributes : array<string|int, mixed>
Return values
mixed —SetStyles()
Set the style of a tag.
public
SetStyles(string $tag, array<string|int, mixed> $attributes) : mixed
Parameters
- $tag : string
- $attributes : array<string|int, mixed>
Return values
mixed —WriteHTML()
Create a PDF from HTML code.
public
WriteHTML(string $html[, string $charset = 'cp874' ]) : mixed
Render the output based on the format specified by Kosit.
Parameters
- $html : string
-
HTML4 code
- $charset : string = 'cp874'
-
default cp874 (Thai language)
Return values
mixed —applyCSS()
Apply CSS styles to the document.
protected
applyCSS(DOMNode $node) : mixed
Parameters
- $node : DOMNode
-
DOM node
Return values
mixed —calculateColumnsWidth()
Calculate the width of columns as a percentage.
protected
calculateColumnsWidth(DOMNode $table) : array<string|int, mixed>
Parameters
- $table : DOMNode
-
The table node.
Return values
array<string|int, mixed> —An array of calculated column widths.
calculateSize()
Calculate the size.
protected
calculateSize(int|string $size, int $max_size) : int
Parameters
- $size : int|string
-
The size value (e.g., "100%", "20px").
- $max_size : int
-
The maximum size.
Return values
int —The calculated size.
CheckPageBreak()
Check the height of a table. If the height exceeds the page, start a new page.
protected
CheckPageBreak(int $h) : mixed
Parameters
- $h : int
-
Table height
Return values
mixed —colorToRGb()
Convert HTML hex color value, e.g., #FF0000, to RGB color value.
protected
colorToRGb(string $color) : array<string|int, mixed>
Returns an array [$r, $g, $b], e.g., #FF0000 = [255, 0, 0].
Parameters
- $color : string
-
The HTML hex color value, e.g., #FF0000.
Return values
array<string|int, mixed> —The RGB color value as an array.
drawHr()
Draw a horizontal line.
protected
drawHr(DOMNode $node) : void
Parameters
- $node : DOMNode
-
The node.
Return values
void —drawImg()
Draw an image.
protected
drawImg(DOMNode $node) : mixed
Parameters
- $node : DOMNode
-
The node.
Return values
mixed —drawTable()
Draws a table.
protected
drawTable(DOMNode $table) : mixed
Parameters
- $table : DOMNode
-
The table node.
Return values
mixed —loadStyle()
Loads the CSS of a node.
protected
loadStyle(DOMNode $node) : mixed
Parameters
- $node : DOMNode
-
The node to load the CSS for.
Return values
mixed —NbLines()
Calculate the height of a cell.
protected
NbLines(int $w, string $s) : int
Parameters
- $w : int
-
Width of the cell
- $s : string
-
Text content of the cell
Return values
int —Height of the cell
render()
Renders a node.
protected
render(DOMNode $node) : void
Parameters
- $node : DOMNode
-
The node to render.
Return values
void —resizeImage()
Resizes an image.
protected
resizeImage( $node) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed> —An array containing the coordinates and dimensions of the resized image.
restoredCSS()
Restores CSS properties for a given DOMNode.
protected
restoredCSS(object $node) : mixed
Parameters
- $node : object
-
The DOMNode object to restore CSS properties for.
Return values
mixed —sd()
calculate standard deviation
protected
sd( $array) : float
Parameters
Return values
float —SetStyle()
Set bold, italic, or underline style for rendering text.
protected
SetStyle(string $style, bool $enable) : mixed
Parameters
- $style : string
-
B, I, or U
- $enable : bool
-
true to enable, false to disable