我正在使用printarea jquery:https://github.com/RitsC/PrintArea
但是我在打印时打印颜色有点麻烦
打印时我想要这样打印 https://imagizer.imageshack.us/v2/815x185q90/673/ImZBHd.jpg
这就是我所拥有的: https://imagizer.imageshack.us/v2/437x549q90/674/dDkSRU.jpg
这是我的JS:
$('#imprimir').on('click', function(){// busca os dados ao clicar no botão
$(".area_impressao").printArea({
mode : "iframe",
standard : "html5",
popTitle : 'relatorio',
popClose : false,
extraCss : '../css/impressao_retrato.css',
extraHead : '',
retainAttr : ["id","class","style"],
printDelay : 500, // tempo de atraso na impressao
printAlert : true,
printMsg : 'Aguarde a impressão'
});
});
我也尝试改变这一行,但没有奏效:
extraCss : '../css/impressao_retrato.css, ../css/style.css, ../css/main.css',
提前致谢!
答案 0 :(得分:1)
我认为这可以解决您的问题:
创建一个CSS文件,将所有可打印元素放入其中(打印时可见)。请帮助世界,不打印您的尝试,使用pdf生成器作为打印机。
@media print {
.myCustom{color:#88000;background-color:#FF0000}
/*Set here your custom stiles as you want, each element*/
}