How to apply loading style in dompdf

I am using bootstrap grid for display and I want my client to download it in pdf, so I am using dompdf for this, but dompdf cannot apply bootstrap style. I can't go back and turn my loading grid into basic html tables and use another plugin to convert to pdf. I found them difficult and time consuming (especially when installing composer and then updating I'm a newbie) is there a way out so I can easily apply bootstrap style to my pdf

   $pr_dt=$_POST['hid'];//div elements which i want ot convert them to pdf and also contain bootstap lib link
   include_once("../assets/converter/dompdf/dompdf_config.inc.php");
   $dompdf =  new DOMPDF();
   $dompdf->load_html($pr_dt);
   $dompdf->render();
   $dompdf->stream("MRA.pdf");

      

or at least there is some online converter for boot grid to html tables

+3


source to share


2 answers


You need to make sure dompdf can find your CSS files. You can do this with set_base_path

, for example:

$dompdf->set_base_path("/www/public/css/");

      



You also need to specify the CSS file, for example:

<html>
  <head>
    <link type="text/css" href="style.css" rel="stylesheet" />
  </head>
<body>
...

      

+1


source


'in response now I am getting Can't find font class fontmetrics_cls.php on line 346'



This happens when you need to add Dompdf to your application configuration to enable modules. In zf2 its application.config.php under modules section Hope this helps when I find hours looking for this without any documentation.

0


source







All Articles