mPDF Manual – What Else Can I Do

Columns

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 ]]); 

or

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

Values:

  • 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 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;

Limitations

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

See

Fork me on GitHub