Preserve HTML font color when printing - IE settings, not printer problem

It made me crazy all day. First, I went down the route of print settings, before I realized that the option "Print background and image colors" was disabled in IE, which turned me off.

The latest test code I used:

<html>
<style type="text/css">body{font-family:Courier;}pre{display:inline;}</style>
<body>
<b><font color="#FFFF00">this is a test</font></b><br/>
</body>
</html>

When viewed in IE, β€œthis is a test” is displayed in bright yellow. However, when printing or even previewing the images, this showed up in what I would call dirty yellow. The same is true if I export to PDF via a virtual PDF printer. If I turn on "Printing colors and background images", then yellow is used, but I understand that from what I read, this option cannot be set programmatically.

It is not only yellow, many similar colors turn out to be the same with each other in the print preview, and I need to shade things according to breaking errors, so we can’t just use the ones that are very different.

So how to get around this ??? I don’t understand why setting the background colors affects the foreground text like this (unless I can make it highlight it? My HTML is very simple and has not been used for several years ...)

Cheers for any help

+4
source share
1 answer

Try this css request:

@media print {
  body {
    /*put your styles here*/
  }
}

I am not sure if IE supports it. I'm not sure which versions you come across.

0
source

All Articles