Page 1 of 1
Printing tables with backgrounds
Posted: Wed Jun 14, 2006 7:46 am
by vivekjain
Hi,
I am not sure if this is the place for me to post this question, but am trying my luck.
I try printing a html <Table> with a background color, but then it only prints the text within the table and not the background image. There is a setting in the IE, but then cant expect all the users to do this. Is there a way to do this?
Thanks
Posted: Wed Jun 14, 2006 10:09 am
by pickle
If you've set a background colour for the cells in that table, their background colour will appear over top the background of the table.
Also, I'm moving this to Client Side.
Printing tables with backgrounds
Posted: Wed Jun 14, 2006 11:09 pm
by vivekjain
No, none of the cells have a bg color. It actually is a setting in IE, Tools-> Internet Options - >Advanced -> Print bg color. But I dont expect all the users to make this setting. Is there anyway that this background img printing can happen by defualt?
Thanks
Posted: Wed Jun 14, 2006 11:12 pm
by feyd
nope
Posted: Thu Jun 15, 2006 2:08 am
by wwwapu
You can use regular image to create background-color. It's easy if you only need one color for whole table and you know the dimensions and position of the table. Small example can be found at
http://www.saunalahti.fi/jarzka/esimerk ... print.html
Develop a little further that idea and you can even color every other <tr>.
Posted: Thu Jun 15, 2006 2:17 am
by Benjamin
You could..
Wrap the table in a div with 0 padding.
Make the table Transparent with 0 margin
Create a style sheet for print.
Code: Select all
<link rel="stylesheet" type="text/css" href="print.css" media="print" />
Assign the div a background image in the print.css style sheet
Test it.
Posted: Thu Jun 15, 2006 6:59 am
by vivekjain
Hi agtlewis,
I tried the steps you said, but it doesnt work.
Posted: Thu Jun 15, 2006 7:51 am
by Benjamin
I'm surprised it didn't work. I figured it was worth a shot. It probably works in firefox.