The setColumns() feature does always stack columns to match their height.
This should only be the case when the vAlign setting is set to J or JUSTIFY.
mPdf 8.0.5
PHP 7.2.19
Apache (both on Win + Linux)
<?php
$mpdf = new \Mpdf\Mpdf();
// both not working
// $mpdf->SetColumns(2, '');
$mpdf->WriteHTML('<columns column-count="2" vAlign="J" column-gap="7" />');
$mpdf->WriteHTML('Some text...');
$mpdf->WriteHTML('Some text...');
$mpdf->WriteHTML('Some text...');
$mpdf->WriteHTML('Some text...');
$mpdf->WriteHTML('Some text...');
$mpdf->WriteHTML('Some text...');
$mpdf->Output();
This is the output:

The right column should not be filled with text! It should get filled only if the left column is full - which is obviously not the case here.
Thank you in advance!
Thanks for providing all that information. I have a feeling this is because the keepColumns setting is not enabled: http://mpdf.github.io/reference/mpdf-variables/keepcolumns.html
Pass that through as true when you initialise the mPDF object and it should work correctly.
Thx @jakejackson1 for the quick help!
This did indeed work. Would be great to add this do the docs at least. Though I don't know if that isn't more a bug than something that should be noted in the docs. It seems that the 2nd param of setColumns() has no effect at all. Setting keepColumns = true / false before the setColumns call works as expected!
Maybe the 2nd param should set this setting automatically? No idea if that could have any side-effects...
Thx again & all the best.
This is what I tried and what worked:
```php
$mpdf->setColumns(1);
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
// results in different-height columns
$mpdf->keepColumns = true;
$mpdf->setColumns(2);
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
// results in same-height columns
$mpdf->keepColumns = false;
$mpdf->setColumns(2);
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
$mpdf->WriteHTML('Some text');
Most helpful comment
Thanks for providing all that information. I have a feeling this is because the
keepColumnssetting is not enabled: http://mpdf.github.io/reference/mpdf-variables/keepcolumns.htmlPass that through as
truewhen you initialise the mPDF object and it should work correctly.