简体   繁体   English

html表格在打印后错过了边框颜色和背景颜色

[英]html table miss their border color and background color after print

<input type= "button" value="Print"  onclick="return PrintReport()" class="lbutton"/>
 <iframe frameborder="0" height="768px" width="95%" id="loader" src="" name="loader"/>
 function PrintReport()
        {
            document.getElementById('loader').contentWindow.document.execCommand('Print',false,null);
            return false;
         }

iframe name loader containing aspx page(html table report) 包含aspx页的iframe名称加载器(html表格报告)

on click of button print is sucess but when i preview in pdf format. 单击按钮打印就成功了,但是当我以pdf格式预览时。

then html report misses their border color and background color . 然后html报告错过了它们的边框颜色和背景颜色

i check settings in ie 8 allow background color and images. 我检查即8中的设置允许背景颜色和图像。

How i get table border color and background color after print. 打印后如何获取表格边框颜色和背景颜色。

尝试将内联CSS用作边框颜色。

style="border: 5px solid #333"

I can't recreate your scenario to be sure, but I've had many style issues occur when I've inadvertently "self closed" an iframe element. 我无法确定要重新创建您的方案,但是当我无意中“自动关闭”一个iframe元素时,就会发生很多样式问题。 It is not a self closing element. 它不是一个自闭元素。 It's worth trying... 值得尝试...

Instead of : 代替 :

 <iframe frameborder="0" height="768px" width="95%" id="loader" src="" name="loader"/>

Do this: 做这个:

 <iframe frameborder="0" height="768px" width="95%" id="loader" src="" name="loader"></iframe>

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

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