...

View Full Version : Table Background Image Does Not Print



rfresh
07-11-2008, 07:20 AM
I have a table with a background image and when I go to print the web page, the image does not show up! I have done this on 3 different computer systems with the same results!

How can I get the Table background image to print?

Thanks...

rangana
07-11-2008, 07:46 AM
I've encountered this problem before, and after diagnosing the problem, I was convinced that it was a printer bug.
For a test, try to print this simple code:


<div style="background:#f00;height:500px;width:500px;">Test</div>


We should be able to see a text Test on a red background. See if the printer outputs the expected.

rfresh
07-11-2008, 05:48 PM
It isn't the printer. I printed on 3 different computers with 3 different printers - the table bg image did not print on any of the 3 different printers.

BWiz
07-11-2008, 06:07 PM
Try this:


<link rel="stylesheet" type="text/css" media="print" href="print.css" />


/* print.css */
table.bg {
background-color: #f00;
color: #fff;
}

abduraooft
07-11-2008, 06:25 PM
Or check whether you have print specific styles which removes the background of that table.

rfresh
07-11-2008, 06:32 PM
This is the table below. The image is a coupon type border that my customers can print out.


<TABLE border=0 width="576" height=432 background="coupon.jpg">
<TR><TD>&nbsp;</TD></TR>
<TR><TD align=center><?php echo $_SESSION['php_sc_coupon_header']?></TR>
<TR><TD>&nbsp;</TD></TR>
</TABLE>

rfresh
07-11-2008, 07:48 PM
Someone told me to use this:


<div style="position: absolute;">
<img src="pix/some.png" width="628" height="134" alt="" border="0">
<table style="position: absolute; top: 0; left: 0" border=1>
<tr><td>test</td></tr>
</table>
</div>

I tried that and it works (the bg image prints) - however, in my code I need to print multiple copies of this table and used <P> to space vertically - but now that doesn't work - the tables print next to each other instead of vertically. I suspect this is due to the div tag but I don't know enough about css to know how to use this solution to allow printing of vertical tables using the same bg image! Can someone help please?

rfresh
07-11-2008, 10:13 PM
I found the answer - I changed this line


<div style="position: absolute;">

to



<div style="position: relative;">

and now my tables display and print with the BG image in each of the multiple tables.

Pepe, the bull
07-11-2008, 10:19 PM
If it's just a dotted line coupon border, couldn't you just use a dotted line border.

<TABLE style="border:1px dotted black;" width="576" height=432 background="coupon.jpg">
<TR><TD>&nbsp;</TD></TR>
<TR><TD align=center><?php echo $_SESSION['php_sc_coupon_header']?></TR>
<TR><TD>&nbsp;</TD></TR>
</TABLE>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum