我可以强制文本打印为白色吗? [英] Can I force text to print as white?

查看:110
本文介绍了我可以强制文本打印为白色吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一些文字显示在图像或其他可打印的颜色上。在打印时是否可以强制此文本为白色?默认行为是在大多数浏览器中将白色强制为黑色或灰色。当您在背景颜色/图片被移除的容器中打印文本时,这显然是有意义的,但是在图片上叠加文字的情况下强制使用文本没有意义。



我应该提到,我非常了解打印样式表,只是这样发生,不管设置字体颜色,在IE / chrome / firefox中,字体不显示为白色。它结束了黑色或灰色,取决于浏览器。



若要说明,请参阅:



http://jsfiddle.net/NSwYE/



我个人't认为这是可能的,由于打印的工作方式。

解决方案

这不是完全控制网页作者。



例如,这个小提琴将打印(至少它对我在一个Dell 1720激光打印机)在 b b b b b b b b strong>如果 已选中

用户:


工具 - >打印 - >页面设置 - >打印背景颜色和图片


是不勾选的,那么它不会在前两个打印黑色,但会在最后(因为它是一个 img 标签),但它打印文本灰色,甚至超过 img 标记。因此,看起来打印背景颜色和图像的设置影响浏览器解释文本的方式,并且如果选中则允许真正的白色(敲除效果),但如果未选中则不允许。



Firefox



在这里找到的复选框(似乎工作):


文件 - >页面设置 - >打印背景(颜色和图像)




网页作者Controlled?



我尚未验证这个帖子会做或不做(它不适用于我的下一个小提琴,但它可能是因为它是在一个iframe)。对于应在Chrome中打印的元素,请尝试设置:

  -webkit-print-color-adjust :exact; 


Suppose I have some text which is displayed over an image or some other printable colours. Is it possible to force this text to white when printing? The default behaviour is to force white to black or grey in most browsers. This clearly makes sense when you are printing text in containers with background colours/images which are removed, but doesn't make sense to force the text in the case where you are overlaying text on images.

I should probably mention that I am quite aware of the print stylesheet, it just so happens that regardless of setting the font colour, in IE/chrome/firefox, the font does not appear white regardless. It ends up black or grey depending on the browser. Please show an example of white text over an image if you think it's actually possible.

To illustrate see:

http://jsfiddle.net/NSwYE/

I personally don't think it's possible due to the way printing works. It's pretty annoying none-the-less.

解决方案

This is not entirely in control of the web page author.

For example, this fiddle will print (at least it did for me on a Dell 1720 Laser Printer) white text on any of the three black backgrounds in

IE9

if the user has checked the box found next to:

Tools -> Print -> Page Setup -> "Print Background Colors and Images"

If that box is unchecked, then it will not print the black at all on the first two, but will on the last (since it is an img tag), but it prints the text as a grey, even over the img tag. Thus, it seems that the setting for "Print Background Colors and Images" affects how the browser interprets the text, and will allow a true white (knock-out effect) if checked, but not if unchecked.

Firefox

Checkbox found here (which seems to work):

File -> Page Setup -> "Print Background (colors & images)"

For Chrome? Web Page Author Controlled?

I have not yet verified whether the information from this post will do it or not (it does not work for me on my next fiddle, but it may be because it is in an iframe). For elements that should print in Chrome, try setting:

-webkit-print-color-adjust: exact;

这篇关于我可以强制文本打印为白色吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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