Prashant Shukla
Prashant Shukla

Reputation: 261

Try to add css in mpdf. But not accept anyhow

I have tried to add css in mpdfstyletables.css file but can not able to add new css. PHP code:

<?php

$html = utf8_decode($html);
$html = iconv("UTF-8","UTF-8//IGNORE",$html);
include("./MPDF/mpdf.php");
$tpdf=new mPDF('c','A4','','',32,25,27,25,16,13); 
$tpdf->ignore_invalid_utf8 = true;
$stylesheet = file_get_contents('mpdfstyletables.css');
$tpdf->WriteHTML($stylesheet,1);
$tpdf->WriteHTML($html,2);
$tpdf->Output($fname,'I');
exit();
?>

I have tried this but not work for me.

How can I add css. I appreciate all response. Thanks Ahead.

Upvotes: 1

Views: 370

Answers (1)

Devi
Devi

Reputation: 39

Can you try to render the html content instead of utf8_decode.

i.e,

 $tpdf->WriteHTML(("youtfilename.php")->render(),2);

By using like this I have applied two css files and it's working fine.

Hope it might help!

Upvotes: 1

Related Questions