I have read some posts about how to add css style in mPDF, I am using Yii framework and I tried many ways with no result, any idea about how to make it work?
$this->layout="//layouts/pdf";
$mPDF = Yii::app()->ePdf->mpdf();
$html = $this->render('pdf', array('dataProvider'=>$dataProvider), true);
$stylesheet = file_get_contents(Yii::app()->request->baseUrl.'/css/print.css');
$stylesheet .= file_get_contents(Yii::app()->request->baseUrl.'/css/main.css');
$mPDF->WriteHTML($stylesheet, 1);
$mPDF->WriteHTML($html, 2);
$mPDF->Output('Inmuebles',EYiiPdf::OUTPUT_TO_BROWSER);
Thats the controller code.
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css" media="print" />
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css" />
Thats the code in the layout/pdf
Error:
file_get_contents(/yii/yiitest/css/print.css): failed to open stream: No such file