1

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.

Community
  • 1
  • 1
Prashant Shukla
  • 241
  • 1
  • 5
  • 21

1 Answers1

1

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!

Martin
  • 22,212
  • 11
  • 70
  • 132
Devi
  • 39
  • 9