Reputation: 2097
I am using dompdf 1.0 version to render my html to pdf . css border property is not working for me. below is my pdf code. (samplepdf.php)
<?php
$html = "<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
color : blue;
}
</style>
</head>
<body>
<h2>Table With Border</h2>
<p>Use the CSS border property to add a border to the table.</p>
<table style='width:100%'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</table>
</body>
</html>";
$filename = "newpdffile";
// include autoloader
require_once 'dompdf/autoload.inc.php';
// reference the Dompdf namespace
use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml($html);
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'landscape');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
$dompdf->stream($filename,array("Attachment"=>0));
Below is the output of my pdf.
Below is the output of my html code in browzer.
Problem is border property in css doesnt work in my pdf . Any help? My php version is 7.3.11.
Upvotes: 0
Views: 2538
Reputation: 1
It seems like there is problem in new version of dompdf You should change your border value border:1px solid black; To border: solid 1px black; for me it worked!!! Reference link https://github.com/dompdf/dompdf/issues/2331#issuecomment-751560493
Upvotes: 0
Reputation: 11
It looks like it is bug in this version. I have exactly same problem, so I have already created issue on github https://github.com/dompdf/dompdf/issues/2331
Upvotes: 1