无法以pdf格式加载c3图表

时间:2017-11-21 09:27:36

标签: c# wkhtmltopdf c3.js nreco

pdf未加载视图中的c3图表。

尝试使用--javascript-delay但它不起作用。  generator.CustomWkHtmlArgs =" --javascript-delay 200000&#34 ;;

我尝试了一个静态的svg但是没有渲染的事件

我错过了什么吗?

1 个答案:

答案 0 :(得分:1)

我假设您使用NReco PdfGenerator,它在内部执行wkhtmltopdf工具;这意味着你的问题实际上是关于c3图表和wkhtmltopdf。

这是已知问题:https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1964

简而言之,请尝试执行以下操作:

1)确保用作图表占位符的div具有固定宽度,如:

<div id="myChart" style="width:950px"></div>

2)将以下js代码段添加到呈现c3图表的HTML中:

Function.prototype.bind = Function.prototype.bind || function (thisp) {
    var fn = this;
    return function () {
        return fn.apply(thisp, arguments);
    };
};