Jump to content

Is there any server-side way to make a background color print?


DWilliams

Recommended Posts

I'm coding a reports system for work. It is mostly complete outside of various tinkering, but I have a slight issue. For visual appeal, each report row color is alternated, in other words, one row will be white, the next gray, and repeating like that.

 

The problem here is that these reports are designed specifically to be printed and mailed out to our clients. Our workstations use Firefox, and by default, it does not print background colors, so when a user prints one of my reports it looks like endless amounts of text thrown at a page without the background colors to visually separate areas. I've worked around this problem by going around to each user's computer and enabling "print backgrounds" in their options, but this is hardly ideal. There's the obvious fact that anything requiring me to walk around to everyone's office is bad administration practice, but this also has the downside that EVERY background now prints for them, which is a pain when they try to print some text from a background heavy website.

 

Is there any way for my scripts to signal that a background is necessary and SHOULD be printed? I assume that CSS is the way to do this if it is indeed possible.

Link to comment
Share on other sites

I don't think this can be done through CSS. The reason being that generally, people don't state which media a particular CSS stylesheet is relevant for, and therefore the stylesheet becomes active for all media - including screen and printing. So if you are trying to print this and the background isn't printing, then the making any stylesheet changes isn't going to do anything that it isn't already doing.

 

As such, if there is a way to do this, it will probably be a PHP solution, so I'm moving this thread to the php section of the forum. Good luck!

Link to comment
Share on other sites

Well the reason I figured CSS seemed like the likely solution is because it DOES have some control over how things are printed. I already have it set up so that different fonts are used for the report text when printed as opposed to being viewed on screen. CSS is the only thing I've ever seen that has any sort of server-side control over how a page is printed.

 

Oh well, hopefully somebody has come across this before. It seems like a pretty common thing that someone would want their background color to be printed for a number of reasons.

Link to comment
Share on other sites

printing from a browser will always ignore background images...

 

If you think about it - printing a page out you are getting a hard copy of the information; that doesn't require any design aspect to it.  Use a print sty;le sheet to layout a page so its more easily read on printing but don't try and print out a hi fidelity copy of your design - thats not what you need when reading something...

 

The alternative as roopert says is to create a pdf which, if you MUST have the design aspect, will be the better option.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.