I'm trying to generate a report filled with info from my DB, and I can show it correctly with HTML and boostrap, but when I try to render my html file, the bootstrap stops working.
<?php
//this is my html:
ob_start();
?>
<!-- All my file goes here, including the <link></link> to the boostrap -->
<?php $html = ob_get_clean() ?>
Then, in another file (which i use to create the PDF) i did this:
<?php
require_once 'route/to/dompdf/autoload.inc.php';
use Dompdf\Dompdf;
$dompdf = new Dompdf();
include "firstFileWithHtml.php";
$options = $dompdf->getOptions();
$options->set(array('isRemoteEnabled' => true));
$dompdf->setOptions($options);
$dompdf->loadHtml($html);
$dompdf->setPaper("letter");
$dompdf->render();
$dompdf->stream("file_pdf", array("Attachment" =>false));
?>
And It generates the PDF preview, just without the boostrap.
is there an option i'm missing?
I tried downloading bootstrap, I tried with another versions (4.3.1, 5.0.2, 5.3.0), I tried using the CDN, but nothing is working.
I also tried the solutions in this answer, but putting the css in the same file didn't work, and the method set_base_path
is deprecated.
<link>
tags. Are theirhref
values relative links like/foo.css
, or are they fully-qualified with ahttps://example.com/
at the start?