JavaScript - Cannot print background Image

Asked By jagadeep suggula on 20-Apr-09 02:35 AM
hello friends i am using javascript to print the entire content of the page.
but the problem i am getting while preinting is that i can get only text and the background imge of my content page is not printing...

my code is here......

WebPage1.html:
-------------------
<html>
<head>
function openPage()
{
window.open("WebPage2.html",'wdwCoupon','left=350,top=300,width=460,height=394,toolbar=0,resizable=0,scrollbars=0');  
}
</head>

<body>
<input name="OpenPage" type="button" value="To Open the WebPage2"  onclick="openPage()" />        

</body>
</html>






WebPage2.html:
-------------------


<html>
<head>
<script type="text/javascript" language="javascript">     

function refreshCheck()
        {            
            window.location.reload();            
        }
    
    </script>
</head>

<body style="background-repeat:no-repeat" background="images/gift-coupon.gif" onload="refreshCheck()" >
    <form id="form1" runat="server">
    <div align="right">
        <input name="print" type="button" value="Print" style="background-color:blue;color:White;font-family:Arial" onclick="javascript:window.print()" />            
        <table border="0" style="width:450px;height:330px" cellpadding="0">
        <tr>
            <td colspan="2" style="text-align:right"> this content for printing purpose</td>
        </tr>
        </table>
        
    </div>
    </form>
</body>
</html>

please do reply me as soon as possible.

thank you

re

Web Star replied to jagadeep suggula on 20-Apr-09 02:46 AM

Try changing your browser settings to "print background colors and images".

`Cannot print background Image

mv ark replied to jagadeep suggula on 20-Apr-09 03:01 AM
Browsers typically do not print background images. One workaround is (in IE) to go to Tools | Internet Options, Advanced tab and check
Print background images and colors which is under the Printing section. Another programmatic alternative is manipulate the background image with CSS. Check this link for more info (scroll to the bottom of the page) - http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_23873793.html

its working now

jagadeep suggula replied to mv ark on 20-Apr-09 04:01 AM
Thank you, it helped me....it is working with CSS.
adeel replied to jagadeep suggula on 09-Sep-10 04:48 PM
i'm wondering similar thing how you done that please share the code or tips. thanks