Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Printing table background colors

Posted on 2006-06-29
18
Medium Priority
?
7,419 Views
Last Modified: 2011-08-18
I'm sure I can do this with CSS and NOT using tables at all, but I don't know CSS well enough to rewrite the page to have it look as I want it and I have something of a deadline.  So, that said, I have a table that alternates between light gray and white lines to help clarify each "item" on a report with no table borders.  When I print it, I want the light gray to show up.  Is there a way (possibly a style?) that I force the background color to print?

I'm not awarding points to anyone who says don't use tables unless they provide something that *I* consider a very easy solution without tables.
0
Comment
Question by:Lee W, MVP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 3
  • +3
18 Comments
 
LVL 6

Accepted Solution

by:
pritaeas earned 1000 total points
ID: 17012645
Printing the background color is a setting of your browser. I don't think you can turn it on with CSS if it is turned off in the preferences.
0
 
LVL 16

Assisted Solution

by:sam85281
sam85281 earned 800 total points
ID: 17012702
There is no way to FORCE a user to print background colors.  If you need to do it for you...

In IE:
Go to Tools=>Internet Options=>Advanced Tab=>Scroll down to PRINTING and check "allow background...."

In FF/MOZ:
Go to File=>Page Setup=>Print Background.....

-Sam
0
 
LVL 96

Author Comment

by:Lee W, MVP
ID: 17012715
I really hope that's not true.  Assuming for the moment it is - do you know how to set this in Firefox?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 96

Author Comment

by:Lee W, MVP
ID: 17012744
That will do folks.  I'm going to leave the question open a bit longer in hopes that someone knows a trick, but as I think about it, it makes sense that you can't force it.  I'll live with the manual setting if I must.  If that's all I get, you two will split an A grade.
0
 
LVL 16

Expert Comment

by:sam85281
ID: 17012759
It IS true.  It's a security issue.  Nobody wants to go to a page and print not realizing that they're gonna use up ALL their ink/toner.

Firefox:
Go to File=>Page Setup=>Check the "Print Background(colors and images)" box

-Sam
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 17012778
tables are not the issue here.

as already said, it's a browser setting... it's true.
unfortunately for you and for the ink manufacturers and resellers, but fortunately for everyone else.

for IE only, you might be able to force printing background colors using some ActiveX like this one:  http://www.meadroid.com/scriptx/freedep.asp
0
 
LVL 96

Author Comment

by:Lee W, MVP
ID: 17012817
I disagree - it's not a security issue - your security is not at risk - your supplies are, but not your security.  Again, I understand this now, the problem with this logic though is sometimes pictures are background pictures and other times they are not - it's sometimes quite difficult to tell when a background image will print and when it won't.  As I said, "as I think about it, it makes sense that you can't force it."
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 17012998
note that borders always print.
they can be used as "background" using some CSS manipulation (negative margins for instance) so that your text overlaps the borders... but a perfect result cannot always be obtained.
also, it will add complexity to your page and some browsers might choke on it.
0
 
LVL 3

Assisted Solution

by:leos_
leos_ earned 200 total points
ID: 17015837
We ran into this issue building templates for real estate agents.  They wanted to be able to print the background colours all the time but the default browser setting doesn't print them.  We found if we used a 1x1 gif of the colour we wanted for the background it worked well.  To allow the user to change the background we used a dynamically created 1x1 pixel gif - which was actually pretty easy.

I recommend this.
<table>
 <tr style="background-image:red.gif"><td>col1</td><td>col2,</td></tr>
 <tr style="background-image:blue.gif"><td>col1</td><td>col2,</td></tr>
 <tr style="background-image:red.gif"><td>col1</td><td>col2,</td></tr>
 <tr style="background-image:blue.gif"><td>col1</td><td>col2,</td></tr>
etc.
</table>
0
 
LVL 96

Author Comment

by:Lee W, MVP
ID: 17015851
Hmmm... I'll try that over the weekend (with luck) - thanks.
0
 
LVL 96

Author Comment

by:Lee W, MVP
ID: 17173998
Haven't forgotten about this - still need to check out a couple of the more recent suggestions.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 18011537
Assuming Leos_ is correct
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 18012890
I assume Leos_ is NOT correct.
In all the browser i know, printing background-colors and printing background-images is one and only one setting.
If the background-color does not print, the background-image should not print either.
0
 
LVL 96

Author Comment

by:Lee W, MVP
ID: 18013155
Here's the thing - I turned on the printing options in the browsers - which for me, was sufficient... I would have preferred a way (quite possibly leos_'s way) that didn't require any browser modifications, but I also know if there were, I'd be among the people screaming loudest because companies would undoubtedly abuse it.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 18013786
@GS: That is what I thought too, but I had no time to actually test it.
0
 
LVL 3

Expert Comment

by:leos_
ID: 18015681
For ie 6.0 default printer options print background images but not background colours. Have not tested ie 7 yet.  I'm not 100% sure of other browers so I'm guessing mozilla users don't print or it works for them too. You can change your printing options will over ride this method, or allow it to work on any browser - we were interested in most browsers by default.
0
 
LVL 3

Expert Comment

by:leos_
ID: 18015682
thanks for the assist in good faith.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question