【问题标题】:Unable to print SVG images created by Raphael in IE9无法在 IE9 中打印 Raphael 创建的 SVG 图像
【发布时间】:2015-08-02 23:33:40
【问题描述】:

我使用 Raphael 生成了一个图表。现在,当我尝试使用以下代码打印图表时:

var data = document.getElementById("Graph").innerHTML;
var mywindow = window.open('', '_blank', 'height=400,width=600');
mywindow.document.write('<html><head><title></title></head><body >');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
mywindow.document.close(); // necessary for IE >= 10
mywindow.focus(); // necessary for IE >= 10
mywindow.print();
mywindow.close();
return true;
window.print();

该图表与所有浏览器中的打印对话框一起显示在一个新窗口中。 该图表在 IE>=10 和 chrome 中打印得非常好,但在 IE9 的情况下,仅打印文本而不是完整的图表。

到目前为止,我已经尝试将我的图表页面的 Meta 标签设置为

<meta http-equiv="X-UA-Compatible" content="IE=11;edge,9;" />

禁用IE9的保护模式。

将图表另存为 PDF 也仅提供文本输出。

【问题讨论】:

    标签: javascript internet-explorer svg raphael


    【解决方案1】:

    在您的文档中添加 DOCTYPE,例如作为第一个写的东西

    mywindow.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
    

    【讨论】:

      猜你喜欢
      • 2011-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-23
      • 2015-05-03
      • 2023-03-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多