add a watermark with Yii2 kartik-mpdf
- By Preneesh AV --
- 14-Nov-2019 --
- 174 Comments
add a watermark with Yii2 kartik-mpdf
$HTML='your html content'; $mpdf =new \Mpdf\Mpdf();//please use your kartik mpdf object here $mpdf->SetWatermarkImage('../images/background.jpg'); $mpdf->showWatermarkImage =true; $mpdf->WriteHTML($HTML);// Saves file on the server as 'filename.pdf' $mpdf->Output('filename.pdf', \Mpdf\Output\Destination::FILE);