我正在尝试使用任何图表将我的图表保存为PDF,它在IE9上工作正常,但不适用于IE9。 Anychart是否支持IE9进行PDF导出。
答案 0 :(得分:0)
是的,AnyChart支持IE9(测试9.0.8112.16421)进行PDF导出,请在IE9中尝试以下示例。可以从上下文菜单('另存为PDF')和API方法(点击左上角的标签)获取导出为PDF。
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.anychart.com/releases/8.1.0/js/anychart-bundle.min.js"></script>
<script src="https://cdn.anychart.com/releases/8.1.0/js/anychart-exports.min.js"></script>
<style>
html, body, #container {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="container"></div>
<script>
anychart.onDocumentReady(function () {
var stage = anychart.graphics.create("container");
var chart = anychart.line([
{x: "January", value: 49},
{x: "February", value: 45},
{x: "March", value: 9},
{x: "April", value: 4},
{x: "May", value: 17}
]);
chart.left("5%");
chart.title("Save chart as PDF file");
chart.container(stage);
chart.draw();
var customLabel = anychart.standalones.label();
customLabel.background({fill: "#9E9E9E"});
customLabel.text("Save image");
customLabel.fontColor("#fff");
customLabel.padding(5);
customLabel.offsetX(5);
customLabel.listen("click", function () {
// Saves into PDF file.
chart.saveAsPdf("a4", true, 100, 50, "PdfChart");
});
customLabel.listen("mouseOver", function () {
document.body.style.cursor = "pointer";
});
customLabel.listen("mouseOut", function () {
document.body.style.cursor = "auto";
});
customLabel.container(stage);
customLabel.draw();
});
</script>
</body>
</html>
答案 1 :(得分:0)