i have one image background of table with following syntax
style="background-image(URL)"
the problem is when i print it on printer it did't print.
can you please tell me how to get this
image background also get it printed on paper as watermark.
i need any code 开发者_JAVA百科not to ask every user to change the browse settings.
Thanks
This can be configured from within the browser. When you open print options, there is an option asking you whether to print background images. :)
As you might have noticed from the answers, browsers by default do not print background images. Also, there is no way to coerce all the visitor's browsers into printing the watermark.
A possible way to force the watermark to be printed is to create a div which is positioned under the content with multiple repeats of an IMG tag containing the watermark. This is horribly kludgy.
Most browsers have an option to print backgrounds. In FF 3.6.3, under File --> Page Setup --> Print Background (Colors and images)
The users would probably not want to waste ink on a background anyways.
I would suggest using an absolutely positioned div with z-index of 0 as the wallpaper, absolutely positioned content div with z-index of 1 for content.
To alleviate the ink issue, you could use the css @media print directive to change the opacity of the background to somewhere between 5 and 10%, making it more of a watermark.
Here's a fiddle: http://jsfiddle.net/Xfxg3/
CSS:
@media print {
#background{
opacity:0.4;
filter:alpha(opacity=40); /* For IE8 and earlier */
}
}
#background{
position:absolute;
z-index:0;
background:#255;
display:block;
min-height:100%;
min-width:100%;
}
#content{
position:absolute;
z-index:1;
}
HTML:
<div id="content">
There is some content in here
</div>
精彩评论