2012-03-13 108 views
0

我正在尝试打印包含文本和图像的报告。我正在使用JavaScript函数来调用打印功能。除了页面上的图像没有出现在新的打印窗口中之外,一切正常。我已经包含了所有的CSS文件,但仍然没有出现在新的打印窗口中。即使我不包含CSS链接也是如此。无法使用JavaScript打印功能打印图像

我的JavaScript功能打印是:

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(); 
} 

回答

1

是在CSS图像背景图片?如果是这样,浏览器可能不会默认打印这些。如果设置用户的浏览器将不得不改变。

+0

我认为他们是''由OP的声明:'“即使我不包括CSS链接,它也是一样的。”......但我在这个网站上听到了陌生的东西,很难把一切当作理所当然。 – 2012-03-13 01:46:49

+0

不,他们是没有背景图片..他们是条形图和这样的东西 – 2012-03-13 01:56:38

+0

你能告诉我们你正在抓住打印的innerHTML吗? – 2012-03-13 02:25:48