简体   繁体   English

引导面板标题背景色一半着色domPDF

[英]Bootstrap panel heading background color half coloring domPDF

Like title said, below are the encountered problem. 如标题所说,下面是遇到的问题。

View on browser : 在浏览器上查看:

在此处输入图片说明

After converted into pdf using domPDF , background color looks so ugly: 使用domPDF转换为pdf后,背景颜色看起来非常难看:

在此处输入图片说明

Working Environment 工作环境

  • DomPDF : 0.7.x@beta DomPDF:0.7.x@beta
  • Bootstrap Framework : Bootstrap v3.3.5 Bootstrap Framework:Bootstrap v3.3.5

Relevant Code : 相关代码:

// 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();

Am include Stylesheet using external css and the html for that background is just a simple panel : 使用外部CSS包含样式表,并且该背景的html只是一个简单的面板:

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

Is there any workaround on this? 有什么解决方法吗? Plese let me know if any of you want more input or any relevant code sample. 请让我知道您是否需要更多输入或任何相关的代码示例。 Thanks. 谢谢。

There is a bug in dompdf (up to 0.7.0) when using border radius if the bottom-left corner does not have a radius applied. 如果左下角未应用半径,则使用边框半径时dompdf中存在错误(最高0.7.0)。 In this situation dompdf doesn't correctly complete the mask definition resulting in the alternate side short-cutting back to the origin point. 在这种情况下,dompdf无法正确完成蒙版定义,从而导致备用边快速切回到原点。

To work around the issue you can apply a small border radius of 1px to the bottom-left corner. 要变通解决此问题,您可以在左下角应用1px的较小边框半径。

For a Bootstrap panel you could just add the following CSS to your stylesheet: 对于Bootstrap面板,您可以将以下CSS添加到样式表中:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM