Menu

## Pdf extends FPDF
in package

Pdf.php : 18

Pdf Class

##### Tags

see
  https://www.kotchasan.com/

### 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

Pdf.php : 23
`protected mixed $B`

#### $css

Pdf.php : 35
`protected mixed $css`

#### $cssClass

Pdf.php : 39
`protected mixed $cssClass`

#### $fontSize

Pdf.php : 43
`protected mixed $fontSize`

#### $I

Pdf.php : 27
`protected mixed $I`

#### $lastBlock

Pdf.php : 47
`protected mixed $lastBlock = true`

#### $lineHeight

Pdf.php : 51
`protected int $lineHeight = 5`

#### $link

Pdf.php : 55
`protected mixed $link = null`

#### $U

Pdf.php : 31
`protected mixed $U`

#### $unit

Pdf.php : 59
`protected mixed $unit`

### Methods

#### __construct()

Pdf.php : 351

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()

Pdf.php : 77

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()

Pdf.php : 168

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()

Pdf.php : 191

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()

Pdf.php : 306

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()

Pdf.php : 319

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()

Pdf.php : 333

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()

Pdf.php : 557

Apply CSS styles to the document.

`protected applyCSS(DOMNode $node) : mixed`

##### Parameters

$node : DOMNode

  DOM node

##### Return values

mixed —

#### calculateColumnsWidth()

Pdf.php : 626

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()

Pdf.php : 712

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()

Pdf.php : 470

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()

Pdf.php : 733

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()

Pdf.php : 749

Draw a horizontal line.

`protected drawHr(DOMNode $node) : void`

##### Parameters

$node : DOMNode

  The node.

##### Return values

void —

#### drawImg()

Pdf.php : 812

Draw an image.

`protected drawImg(DOMNode $node) : mixed`

##### Parameters

$node : DOMNode

  The node.

##### Return values

mixed —

#### drawTable()

Pdf.php : 844

Draws a table.

`protected drawTable(DOMNode $table) : mixed`

##### Parameters

$table : DOMNode

  The table node.

##### Return values

mixed —

#### loadStyle()

Pdf.php : 932

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()

Pdf.php : 485

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()

Pdf.php : 994

Renders a node.

`protected render(DOMNode $node) : void`

##### Parameters

$node : DOMNode

  The node to render.

##### Return values

void —

#### resizeImage()

Pdf.php : 1077

Resizes an image.

`protected resizeImage( $node) : array<string|int, mixed>`

##### Parameters

$node :

  The node containing the image.

##### Return values

array<string|int, mixed> —

An array containing the coordinates and dimensions of the resized image.

#### restoredCSS()

Pdf.php : 1128

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()

Pdf.php : 1178

calculate standard deviation

`protected sd( $array) : float`

##### Parameters

$array :

##### Return values

float —

#### SetStyle()

Pdf.php : 540

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

##### Return values

mixed —

## Search results