0

I am trying to print a report which includes text and images. I am using a javascript function to invoke the print functionality. Everything works well except the images on the page do not show up in the new print window. I have included all the CSS files with it but still my images dont appear in the new print window. Its the same even if I dont include the CSS links.

My javascript function to print is :

function printfun(){
        var disp_setting = "toolbar=no,location=no,directories=no,menubar=no,";
        disp_setting += "scrollbars=no,left=0,top=0,resizable=yes,width=900 height=650,modal=yes,";
        var content_vlue = document.getElementById('<%= tblCharts.ClientID %>').innerHTML;   
        var docprint = window.open("", "", disp_setting);
        docprint.document.write('<html><head>');
        docprint.document.write('</head>');
        docprint.document.write('<body onLoad="self.print()">');
        docprint.document.title = "";
        docprint.document.write('<link href="../style/design.css" rel="Stylesheet" type="text/css" />');
        docprint.document.write('<link href="../App_Themes/style/graphs.css" rel="Stylesheet" type="text/css" />');
        docprint.document.write(content_vlue);
        docprint.document.write(tblCharts);        
        docprint.document.write("</body></html>");
        docprint.document.close();
        docprint.focus();
}
0

1 Answer 1

1

Are the images background images in the CSS? If so, the browser likely isn't set to print those by default. That'd a browser setting the user would have to change.

Sign up to request clarification or add additional context in comments.

3 Comments

I'd assume they're <img> by the OP's statement: "Its the same even if I dont include the CSS links."... but I have heard stranger things on this site, it's hard to take anything for granted.
No they are no background images.. they are bargraphs and such stuff
Can you show us the innerHTML that you are grabbing to print?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.