VKB
VKB

Reputation: 147

PDF having Highcharts (multiple series) chart generated using svg2pdf.js throws error

In case of chart having multiple series (a line series and a column series), if column series is disabled and PDF is generated, the resulting PDF throws error when tried to open using Acrobat Reader. The same PDF does not show error if opened in browser though. Also note that the same issue does not occur if line series is disabled and output PDF has only column series.

Refer JSFiddle: https://jsfiddle.net/xL2q75vr/1/

$('#download1series').click(()=>{
   var svg = document.getElementById('chart-container').querySelector("svg"),
   pdf = new jsPDF('l', 'pt', [chart.chartWidth, $(window).height()]);
svg2pdf(svg, pdf, {
removeInvalid: true,
scale: 72 / 96, // this is the ratio of px to pt units
 });

 pdf.save('output.pdf');
});

Why does PDF throws error only when opened using Acrobat reader? Please help.

Note: svg2pdf.js is used for exporting Highcharts generated charts into pdf instead of default PDF export functionality of Highcharts, as the resulting pdf should also have html content (header and footer with icons) along with charts.

Upvotes: 0

Views: 393

Answers (1)

Wojciech Chmiel
Wojciech Chmiel

Reputation: 7372

FYI: this issue was fixed. Check here: https://github.com/yWorks/svg2pdf.js/issues/71

Upvotes: 0

Related Questions