Jspdf: Adding SVG element to PDF

Created on 7 Nov 2016  路  9Comments  路  Source: MrRio/jsPDF

How can I add an SVG element to PDF that I dynamically created and assigned to a variable with javascript?

Most helpful comment

It should be nice to have a minimal working example...

All 9 comments

Any luck on this?

doc.addSVG?

Yeah, you right. But with hightcharts it was terrible. Funally I resolved it without jsPDF - just 30 strings in js with hightcharts library.

Actually I am working on the same issue :) I am using angular2-highcharts but imo highcharts svg are to complex for the doc.addSVG function so that does not work. How did you solve it?

@suuuunto , I created gist with comments: https://gist.github.com/aorzh/2df77ce9f43198387a87abe84de94dcd
Enjoy :)

In my case, I try to get a png data uri to add this in a second step to the pdf.

I think I can not do this with your approach, right?

@suuuunto , how about some png to svg convertion? I foung this: https://github.com/ehtd/png2svg but didn't reviewed yet. Fill free to check. Maybe better swithch our discussion to https://gist.github.com/aorzh/2df77ce9f43198387a87abe84de94dcd ? Because I think this is not in jsPDF scope :-)

We will have in 1.4.1 addSvgAsImage-method added

It should be nice to have a minimal working example...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sajesh1985 picture sajesh1985  路  5Comments

baluMallisetty picture baluMallisetty  路  4Comments

yankeeBrit picture yankeeBrit  路  3Comments

mackersD picture mackersD  路  4Comments

glaier picture glaier  路  3Comments