I'm looking for a solution about highcharts export to PDF with jsPDF. I used this solution to export my graph as image to my pdf -> Export Highcharts to PDF (using javascript and local server - no internet connection)
It's working fine, but for some graph i could not generate the image because of this error :
Uncaught TypeError: undefined is not a function -- canvg.js:2000
svg.Element.text.getAnchorDelta -- canvg.js:2010
svg.Element.text.renderChild -- canvg.js:1989
svg.Element.text.renderChildren -- canvg.js:679
svg.Element.ElementBase.render -- canvg.js:698
svg.Element.ElementBase.renderChildren -- canvg.js:679
svg.Element.ElementBase.render -- canvg.js:698
svg.Element.ElementBase.renderChildren -- canvg.js:679
svg.Element.ElementBase.render -- canvg.js:2723
svg.loadXmlDoc.draw -- canvg.js:2733
svg.loadXmlDoc -- canvg.js:2646
svg.loadXml -- canvg.js:62
canvg -- indicateurs.js:3237
$.bind.H.Chart.createCanvas -- indicateurs.js:3171
(anonymous function) -- jquery-1.10.2.min.js:4
x.extend.each -- indicateurs.js:3164
_indicateurs.hightcharts.graph_to_pdf -- indicateurs.js:3262
(anonymous function) -- jquery-1.10.2.min.js:5
x.event.dispatch -- jquery-1.10.2.min.js:5
x.event.add.v.handle
Following, the canvas method throwing the error (canvg.js) :
this.getAnchorDelta = function (ctx, parent, startI) {
var textAnchor = this.style('text-anchor').valueOrDefault('start');
if (textAnchor != 'start') {
var width = 0;
for (var i=startI; i<parent.children.length; i++) {
var child = parent.children[i];
if (i > startI && child.attribute('x').hasValue()) break; // new group
width += child.measureTextRecursive(ctx); // ######## PROBLEM LOCATED ON THIS LINE
}
return -1 * (textAnchor == 'end' ? width : width / 2.0);
}
return 0;
}
Any first ideas about what could be make this error ?