在Firefox上强制背景颜色打印 [英] Force Background Color Printing on Firefox

查看:176
本文介绍了在Firefox上强制背景颜色打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了 Barby 红宝石宝石,它增加了一个方便的方法将条形码呈现为HTML

Barby根据传递给它的代码来呈现一个带有 td 背景的表格。这工作得很好,因为我不想为每个需要条形码的记录生成和存储图像文件。



主流浏览器不打印背景颜色默认情况下,我需要条形码打印,而不会让用户更改本地系统上的打印选项。

我不确定如何使用Firefox来完成此操作。使用webkit(Chrome和Safari),这非常简单:

  td {
background:#000!important;
-webkit-print-color-adjust:exact;
}

Feverish Google搜寻功能并没有真正让我知道:问题是几年,我还没有找到任何新的东西,所以我觉得我' d再次提出这个问题。 脂肪边界也不会真正的工作,因为如果条之间的关系改变,它会改变包含在代码。

解决方案

这是开始在Firefox(至少版本48.0.2)与 color-adjust 属性。

  td {
background:#000!important;
-webkit-print-color-adjust:exact;
color-adjust:exact;



$ b我在我的特定项目中看到一个或两个小错误,但背景颜色正在显示!


I'm using the Barby ruby gem which adds a handy way to render barcodes as HTML.

Barby renders a table with td backgrounds on or off based on the code passed to it. This works pretty well because I don't want to generate and store an image file for every record I need a barcode for.

The major browsers don't print background colors by default and I need the barcode to print without making the user change a print option on their local system.

I'm not sure how to accomplish this with Firefox. With webkit (Chrome and Safari), it's pretty easy:

td { 
  background: #000 !important;
  -webkit-print-color-adjust: exact;
}

Feverish Googling hasn't really gotten me anywhere: This question is a few years old and I haven't found anything newer so I figure I'd pose the question again. Fat borders also won't really work because if the relationship between the bars change, it'll change the data contained in the code.

解决方案

This is beginning to work in Firefox (at least version 48.0.2) with the "color-adjust" property.

td { 
  background: #000 !important;
  -webkit-print-color-adjust: exact;
  color-adjust: exact;
}

I see a minor bug or two in my particular project, but the background colors are showing up!

这篇关于在Firefox上强制背景颜色打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆