phpdftk API Documentation

Table
in package

FinalYes

Tabular data placed via `Pdf::addTable()` (flow) or `Writer\Page::drawTable()` (positioned).

Cells are plain strings; multi-line content is produced automatically by greedy word-wrapping at the column width. For richer content (mixed fonts, images, nested tables), drop to the writer's drawing API.

Column widths are absolute points; if $columnWidths is null, the renderer divides the available width equally across columns.

Table of Contents

Properties

$columnWidths  : array<string|int, mixed>|null
$headerRow  : array<string|int, mixed>|null
$rows  : array<string|int, mixed>

Methods

__construct()  : mixed
columnCount()  : int
Number of columns in the table — taken from the header row when present, otherwise from the widest body row.

Properties

$columnWidths read-only

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

$headerRow read-only

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

$rows read-only

public array<string|int, mixed> $rows

Methods

__construct()

public __construct(array<int, array<int, string>> $rows[, array<int, float>|null $columnWidths = null ][, array<int, string>|null $headerRow = null ]) : mixed
Parameters
$rows : array<int, array<int, string>>

Body rows; each row's length should match column count.

$columnWidths : array<int, float>|null = null

Per-column width in points, or null for equal columns.

$headerRow : array<int, string>|null = null

Optional repeating header row.

columnCount()

Number of columns in the table — taken from the header row when present, otherwise from the widest body row.

public columnCount() : int
Return values
int

        
On this page

Search results