setasign\Fpdi

FpdfTpl Class FpdfTpl

File: /FPDI v2/FpdfTpl.php

This class adds a templating feature to FPDF.

Class hierarchy

Uses

Summary

Properties

$currentTemplateId

protected null|int FpdfTplTrait::$currentTemplateId

The template id for the currently created template.

$templateId

protected int FpdfTplTrait::$templateId = 0

A counter for template ids.

$templates

protected array FpdfTplTrait::$templates = array()

Data of all created templates.


Methods

AddPage()

public FpdfTplTrait::AddPage (
[ $orientation = '' [, $size = '' [, $rotation = 0 ]]]
): void

Parameters
$orientation
 
$size
 
$rotation
 

Link()

public FpdfTplTrait::Link (
$x, $y, $w, $h, $link
): void

Parameters
$x
 
$y
 
$w
 
$h
 
$link
 

SetDrawColor()

public FpdfTplTrait::SetDrawColor (
$r [, $g = null [, $b = null ]]
): void

Parameters
$r
 
$g
 
$b
 

SetFillColor()

public FpdfTplTrait::SetFillColor (
$r [, $g = null [, $b = null ]]
): void

Parameters
$r
 
$g
 
$b
 

SetFont()

public FpdfTplTrait::SetFont (
$family [, $style = '' [, $size = 0 ]]
): void

Parameters
$family
 
$style
 
$size
 

SetFontSize()

public FpdfTplTrait::SetFontSize (
$size
): void

Parameters
$size
 

SetLineWidth()

public FpdfTplTrait::SetLineWidth (
$width
): void

Parameters
$width
 

SetLink()

public FpdfTplTrait::SetLink (
$link [, $y = 0 [, $page = null ]]
): void

Parameters
$link
 
$y
 
$page
 

_out()

public FpdfTplTrait::_out (
$s
): void

Parameters
$s
 

_putimages()

protected FpdfTplTrait::_putimages (
void
): void

_putxobjectdict()

protected FpdfTplTrait::_putxobjectdict (
void
): void

beginTemplate()

public FpdfTplTrait::beginTemplate (
[ float|int|null $width = null [, float|int|null $height = null [, bool $groupXObject = false ]]]
): int

Begins a new template.

Parameters
$width : float|int|null

The width of the template. If null, the current page width is used.

$height : float|int|null

The height of the template. If null, the current page height is used.

$groupXObject : bool

Define the form XObject as a group XObject to support transparency (if used).

Return Values

A template identifier.

endTemplate()

public FpdfTplTrait::endTemplate (
void
): bool|int|null

Ends a template.

Return Values

A template identifier.

getNextTemplateId()

protected FpdfTplTrait::getNextTemplateId (
void
): int

Get the next template id.

getTemplateSize()

public FpdfTplTrait::getTemplateSize (
mixed $tpl [, float|int|null $width = null [, float|int|null $height = null ]]
): array|bool

Get the size of a template.

Omit one of the size parameters (width, height) to calculate the other one automatically in view to the aspect ratio.

Parameters
$tpl : mixed

The template id

$width : float|int|null

The width.

$height : float|int|null

The height.

Return Values

An array with following keys: width, height, 0 (=width), 1 (=height), orientation (L or P)

setPageFormat()

public FpdfTplTrait::setPageFormat (
array $size, string $orientation
): void

Set the page format of the current page.

Parameters
$size : array

An array with two values defining the size.

$orientation : string

"L" for landscape, "P" for portrait.

Exceptions

Throws \BadMethodCallException

useTemplate()

public FpdfTplTrait::useTemplate (
mixed $tpl [, array|float|int $x = 0 [, float|int $y = 0 [, float|int|null $width = null [, float|int|null $height = null [, bool $adjustPageSize = false ]]]]]
): array

Draws a template onto the page or another template.

Omit one of the size parameters (width, height) to calculate the other one automatically in view to the aspect ratio.

Parameters
$tpl : mixed

The template id

$x : array|float|int

The abscissa of upper-left corner. Alternatively you could use an assoc array with the keys "x", "y", "width", "height", "adjustPageSize".

$y : float|int

The ordinate of upper-left corner.

$width : float|int|null

The width.

$height : float|int|null

The height.

$adjustPageSize : bool
 
Return Values

The size

See