Multiple columns can be used on a page. This can started and stopped anywhere in the document, by either:
<?php $mPDF->SetColumns(nCols[, vAlign [, gap ]]);
<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
'justify'. Default Off. (Optional)
gap- gap in mm between columns. Default
<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 as a configuration variable max_colH_correction - too large a value can give ugly results:
<?php $mPDF->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 KeepColumns
<?php $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
Note: Block element borders (P,DIV etc) in columns may appear as disjointed lines. This is because they are written to the document line by line to allow repositioning when the columns are adjusted. The borders should appear correctly when “zoomed in” and when printing. Table cell borders may be similarly affected. Also note that the horizontal borders between table cells will only appear half width if a background color is used in the cell below, because the cell background may write over the bottom half of the border.
Note: To create columns that span more than one page, use Floating blocks.