I use Highcharts to draw a graph.
I want to add "export to PNG" option that includes both Highcharts graph and outer div. When using Highcharts export, I'm unable to add the outer div containing the chart.
I saw several examples here using html2canvas. When I tried using it, the Highcharts' SVG element wansn't included in the output image.
Does anyone know a solution, better than trying to merge SVG image inside outer HTML div image?
Update -
Using the latest version of html2canvas fixed that issue, however the output is slightly different:
html2canvas output:
As you can see some elements are rendered twice in different locations.
Anyone knows how to solve it?
I think you are dealing with a few edge cases of svg to bitmap conversion.
I am not sure which method html2canvas uses, but it certainly lacks in something here.
I wrote a function that handles some of theses edge cases that you could use before calling html2canvas, since it is able to draw bitmaps without any problem.
Note :
From this question, I started to write a full exportInlineSVG function that you can find here.