heavyai / mapd3

MapD3 charts library optimized for fast interactivity
Other
41 stars 14 forks source link

Tainted Issue while exporting SVG to PNG / PDF #64

Open vpenugonda opened 6 years ago

vpenugonda commented 6 years ago

Can some share their ideas?

SVG's are not properly exporting when I use HMTL2Canvas and svgs turned out tainted. tried canvg.

FYI, I wanted to implement something like this using MAPD Charting https://jsfiddle.net/gh/get/jquery/1.11.0/highslide-software/highcharts.com/tree/master/samples/highcharts/exporting/offline-download-demo/

biovisualize commented 6 years ago

Although this is a general DOM issue and not specific to Mapd3, here is a general way to convert from SVG to canvas to png while preventing the tainted canvas issue: https://gist.github.com/biovisualize/8187844 You would have to modify it to work with HTML as Mapd3 charts are a mix of SVG and HTML. If you succeed feel free to roll this up into a plugin and submit a pull request :)