mPDF Manual – What Else Can I Do



Multiple columns can be used on a page. This can started and stopped anywhere in the document, by either:

$mPDF->SetColumns(nCols[, vAlign [, gap ]]); or

<columns  column-count=”n” vAlign=”justify” column-gap=”n” />

nCols = Number of columns. Anything less than 2 sets columns off. (Required)

vAlign = Automatically adjusts height of columns to be equal if set to J or justify. Default Off. (Optional)

gap = gap in mm between columns. Default 5. (Optional)

<columnbreak /> <column_break /> or <newcolumn /> (synonymous) can be included to force a new column. (This will automatically disable any justification or readjustment of column heights.)

The maximum ratio to adjust column height when justifying is defined at the top of the mpdf.php file - too large a value can give ugly results:

var $max_colH_correction = 1.15; (default value)

You can keep columns as they are i.e. 1st column will finish page then start on second, by setting


$mpdf->KeepColumns = true;


Columns are incompatible with (and automatically disable): justification if a table is included, table rotation, collapsible margins for blocks e.g. top and bottom margins for a DIV will not collapse (default) at the top/bottom of a column. Support for block-level borders (DIV, P etc) was added in mPDF 3.0