Bootstrap 面板标题背景颜色半着色 domPDF

Bootstrap panel heading background color half coloring domPDF

如题所示,下面是遇到的问题

在浏览器上查看:

使用domPDF转成pdf后,背景颜色很难看:

工作环境

相关代码:

// instantiated Dompdf obj
$dompdf = new Dompdf();
// model method for data populating
$data = $this->populateStatus( 31 );
// call the view together with data
$page = $this->load->view('model/controller', $data, true );
$dompdf->loadHtml( $page );
// (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();

我使用外部 css 包含样式表,而该背景的 html 只是一个简单的面板:

<div class="panel panel-default">
    <div class="panel-heading page">
       Text Here
    </div>
</div>

有什么解决方法吗?如果你们中的任何人想要更多的输入或任何相关的代码示例,请告诉我。谢谢。

如果左下角没有应用半径,则在使用边框半径时 dompdf(最高 0.7.0)存在错误。在这种情况下,dompdf 没有正确完成掩码定义,导致备用边捷径回到原点。

要解决此问题,您可以在左下角应用 1 像素的小边框半径。

对于 Bootstrap 面板,您只需将以下 CSS 添加到您的样式表中:

.panel-heading { border-bottom-left-radius: 1px; }