0

I have imported the google fonts but not working while generating the PDF using dompdf.

here I shared my code

$html = $html . '<head>
<style>
@import url("https://fonts.googleapis.com/css2? 
family=Roboto:wght@400;500&display=swap");
body {
 font-family: "Roboto", sans-serif;
}
</style>
</head>';

$html = $html .'
<div style="display:inline-block;font-weight: 600;font-family: "Roboto", sans-serif;">Test DOM PDF</div>';
   require_once 'dompdf/autoload.inc.php';
  use Dompdf\Dompdf;
  $dompdf = new Dompdf();
  $dompdf->set_option('isRemoteEnabled', true);
  $dompdf->loadHtml($html);
  $dompdf->render();
  $dompdf->stream("testfile", array("Attachment" => 0));
  $dompdf->output();

Please help me out.

0 Answers0