I have created a HTML page to display bar chart. Each bar is specified using div with a background-color. The chart displays fine in browser but color won't show up when my users print it out. I understand browser default configuration can be changed in order to force background color in print, but this is NOT an option for my users since they don't have rights to re-config browser settings. What would be a alternative way to force the bar color to be printed? Appriciate any suggestions. Thank you. Ellen
<link rel="stylesheet" media="print" href="print.css" type="text/css" /> Try styling the background of the desired element in a css file that has it's media type set to "print"
thank you so much for replying my question! I actually tried the approach you suggested: in my HTML page, I have both <link rel="stylesheet" media="print" href="print.css" type="text/css" /> <link rel="stylesheet" media="screen" href="screen.css" type="text/css" /> print.css and screen.css are identical css file with different file name, where div background-color is set as red, but it didn't seem the print.css works, the print out is still having white background. Did I do it wrong? Thank you again for helping! Ellen
It's likely that the browser's print settings are overriding your web pages. After all, most users might not want to waste ink by printing backgrounds on web pages. For example, take a look at the Page Setup dialog box in Firefox 2. There's a checkbox for "Print Background" that's unchecked by default. If you check it, your background should print. But you can't force every user to do that.
Try declaring your print css file second, and use !important at the end of your style sheet declaration to override the user's browser preferences. ex. Background: #000 !important;
Yeah, I think you're right. The only way to do it is through an active X object or possible Java because it turns out, it's not a function of browser rendering, it's a function of the browser's operations with the printer, which would be completely separate from anything in css or even javascript.
Hmmm, so Ellen, you'll have to talk to the users' sysadmin then if they can't themselves change the browser/printer settings.