Abhishek Nath
Abhishek Nath

Reputation: 25

Unable to load c3 charts in pdf

the pdf is not loading c3 charts which are there in views.

Tried using --javascript-delay but it does not work. generator.CustomWkHtmlArgs = " --javascript-delay 200000 ";

i tried putting a static svg but event that is not rendering

Am i missing anything?

Upvotes: 1

Views: 534

Answers (1)

Vitaliy Fedorchenko
Vitaliy Fedorchenko

Reputation: 9235

I assume you use NReco PdfGenerator which is internally executes wkhtmltopdf tool; this means that your question is actually about c3 charts and wkhtmltopdf.

This is known issue: https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1964

In short, try to do the following:

1) ensure that your div used as chart placeholder has fixed width, smth like:

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

2) add the following js code snippet to your HTML that renders c3 charts:

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

Upvotes: 1

Related Questions