I'm using d3.js to create a chart which I want to some how export in vector format to edit in illustrator. Is this possible? This is a snippet of the code that's generated:
Asked
Active
Viewed 1.1k times
7
-
1possible dupe: http://stackoverflow.com/questions/8435537/convert-javascript-generated-svg-to-a-file – vinczemarton Jan 23 '12 at 15:13
2 Answers
9
There are more complicated methods involving node.js and server-side rendering but a quick, easy way is to just copy the svg element from the DOM, paste it into a file and save it with the extension .svg
After that you can open it in a vector editor.

Tyson Anderson
- 413
- 3
- 9
-
1Quick update: Since the method described above will not take an external css file into account I've found that a better method is to use this command line tool for writing html content to a pdf: http://plessl.github.com/wkpdf/ – Tyson Anderson Feb 06 '13 at 22:14
-
7Update #2: SVG Crowbar is a super handy tool made just for this purpose http://nytimes.github.io/svg-crowbar/ – Tyson Anderson Apr 10 '13 at 08:41
-
This method works exceptionally good with svg layers on a leaflet.js map. Thanks! – waeltken Dec 03 '15 at 15:21
0
You can try this: saveSvgAsPng

sidian
- 31
- 1
-
1The OP asked for an export in vector format and your suggested library do the opposite. – smwhr Jul 13 '20 at 12:38