I am using Morris.js to create graphs. I have requirement to export graphs as pdf. I can see that graphs are svg elements. What should i do to achieve this.
I took one of the Morris samples and made a fiddle for you:
http://jsfiddle.net/1roLdqte/48/
I added a simple call to format to PDF the existing div with just the morris chart:
$('#print').click(function () {
printMe();
});
function printMe() {
xepOnline.Formatter.Format('line-example',{render:'download', srctype:'svg'});
}
Run the fiddle and push the PDF button.
Note there are many more parameters available here, you can format much more content than just the morris.js chart, control page sizes, add header/footers and such. This only formats the chart alone (srctype:'svg') to PDF as a vector image (not raster).