mPDF Manual – mPDF functions

SetColumns()

(mPDF >= 1.0)

SetColumns – Control use of Columns on the page

Description

void SetColumns ( int $nCols [, string $vAlign [, float $gap ]])

Define, start or stop Columns in the document.

Parameters

$nCols

Set the number of (vertical) columns to use on a page

BLANK or omitted or 0 or 1 turns Columns OFF i.e. the whole page is used as one column.

Default: 1

$vAlign

Automatically adjusts height of columns to be equal if set to 'J' or 'justify'.

BLANK or omitted turns vertical-alignment OFF

Values (case-insensitive)

  • '' (BLANK) or omitted: turns vertical alignment off
  • 'J' or 'justify': Automatically adjusts height of columns to be equal

Default: ''

$gap

Set the gap between columns in millimeters

BLANK or omitted uses default value.

Default: 5 (mm)

Examples

Example #1

<?php
$mpdf = new \Mpdf\Mpdf();

$mPDF->SetColumns(2, 'J', 3);

$mpdf->WriteHTML('Some text...');
$mpdf->AddColumn();
$mpdf->WriteHTML('Next column...');

$mpdf->Output();

See Also

  • AddColumn() - Start a new Column
  • <columnbreak> - Start a new Column
  • <columns> - Control the use of multiple columns on the page - HTML equivalent of SetColumns()
Fork me on GitHub