I'm using bootstrap grid to display and i want that my client download it in pdf so for that i'm using dompdf but dompdf is not able to apply bootstrap style. I cannot go back and turn my bootstrap grid to basic html tables and using different plugin to convert to pdf i found them difficult and time consuming(especially in installing composer and then updating i'm new ) is there any way out so that 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 is there any online converter for bootstrap grid to html tables
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 a to specify the CSS file, something like:
<html>
<head>
<link type="text/css" href="style.css" rel="stylesheet" />
</head>
<body>
...
Put All CSS codes in same page . Do not refer CSS to external link .
Work with inline tags like margin ,padding ,top and etc.
I faced the same challenge and solved it by: Add the bootstrap.min.css code at the tag at the top of the page. N.B bootstrap 3 works best.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With