phpdftk API Documentation

TextStyle
in package

FinalYes

Per-call text styling override for {@see Pdf::addText()}.

Every property is nullable; null means "inherit from the document theme". Pass a TextStyle to override font / size / color / weight / alignment for a single addText call without touching the document's default font state.

Example: $pdf->addText('Normal body text.'); $pdf->addText('Red emphasis.', new TextStyle(color: [1, 0, 0]));

Table of Contents

Properties

$alignment  : Alignment|null
$bold  : bool|null
$color  : array<string|int, mixed>|null
$family  : string|null
$italic  : bool|null
$link  : string|null
$size  : float|null
$strikethrough  : bool
$underline  : bool

Methods

__construct()  : mixed

Properties

$bold read-only

public bool|null $bold = null

$color read-only

public array<string|int, mixed>|null $color = null

$family read-only

public string|null $family = null

$italic read-only

public bool|null $italic = null
public string|null $link = null

$size read-only

public float|null $size = null

$strikethrough read-only

public bool $strikethrough = false

$underline read-only

public bool $underline = false

Methods

__construct()

public __construct([string|null $family = null ][, float|null $size = null ][, bool|null $bold = null ][, bool|null $italic = null ][, array{float, float, float}|null $color = null ][, Alignment|null $alignment = null ][, string|null $link = null ][, bool $underline = false ][, bool $strikethrough = false ]) : mixed
Parameters
$family : string|null = null

e.g. 'Helvetica', 'Times', 'Courier'

$size : float|null = null

point size

$bold : bool|null = null
$italic : bool|null = null
$color : array{float, float, float}|null = null

RGB 0–1

$alignment : Alignment|null = null
$link : string|null = null

URI; when set, the rendered text becomes a clickable link.

$underline : bool = false

Draw a horizontal line below the baseline of each rendered line.

$strikethrough : bool = false

Draw a horizontal line through the middle of each rendered line.


        
On this page

Search results