For the following strategy, it requires the browser to support
data:image/svg+xml;... data URIs.
So unfortunately, this will not work with IE, but should work with most major modern browsers.
- Get the
SVGElementfrom the DOM, or generate one
- Use saveSvgAsPng to convert
SVGElementto a JPEG using
- Use jsPDF to create a
jsPDFobject, then insert the JPEG image
- Export the
jsPDFobject as a PDF
Though alternatively, you could use PDFKit depending on your requirements.