In my Yii2 application I use kartik mpdf to generate PDF from html. I have a table on a PDF that is full width in my local machine (Windows) which is the expected behaviour. However, when I deploy it on the Ubuntu server, the table is half width.
I have cross checked the dependecy versions and both the enviornments have identicle dependencies as well.
I confirmed that the parent containers (div) of the table are behaving normally by placing texts within them. Its only the <table>
element that gets dropped in size in the whole PDF when deployed.
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="table-responsive">
<table class="table table-bordered" >
<tbody>
</tbody>
</table>
</div>
</div>
</div>
This is my code for the table without the body.
Any idea whats happening behind and how to fix it?
After many struggles, I found that MPDF shrinks the table to fit the tallest row into one page. If you have multiple rows (cells) merged vertically then you'll run into this.
It is mentioned in the troubleshooting section of the documentation.