Skip to content

Tables & Grids

Latest
Compare
Choose a tag to compare
@famoser famoser released this 03 Jan 21:53
· 4 commits to main since this release

This adds support for grids and tables to the LayoutEngine.

The grid and the table support columns sized relative to the content. While the grid provides gaps (both horizontal as well as vertical), the table provides head and body (with the head printed on every page the table spans over).

$row = new Row();
foreach (['1', 'Second column text'] as $index => $text) {
    $paragraph = new Paragraph();
    $paragraph->add($textStyle, $text);

    $row->setContent($index, $paragraph);
}

$table = new Table([ColumnSize::MINIMAL, ColumnSize::AUTO]);
$table->addBody($row);

$document->add($table);

As part of this release, text copied out of the PDF now works in all readers (not only those which employ OCR). Further, allocation is now guaranteed to always produce a result, which ensures too-big-content also lands on the PDF.