This is my controller code
public function actionPrint_death_certificate1()
{
$this->layout = 'certificate';
$html = $this->render('test');
require_once(Yii::$app->basePath . "/../vendor/mpdf/mpdf/mpdf.php");
$mpdf=new mPDF();
$mpdf->WriteHTML($html);
$mpdf->Output();
}
My view
<div class="container">
<div class="row">
<div class="col-md-6">
Heading1
</div>
<div class="col-md-6">
Heading2
</div>
</div>
</div>
Now i get a pdf with heading1 and heading2 in two different lines. Bootstrap is not working. Am i missing something?
return $this->render('test');
When i tried this one it is working and heading1 and heading2 is coming in one line. In pdf it is not working
You can use the function
$mpdf->WriteHtml($stylesheet, 1)
to add custom stylesheets within your pdf, for more information you can check this link http://mpdf1.com/manual/index.php?tid=254I posted an issue in github and mpdf guys told that bootstrap not supported out-of-the-box inside mpdf and you have to use some custom style. Github link
From @Bloodhound post - this solution works for me well