Not sure if it fits your use case, but; for one project I needed to have charts that the user could modify in their browser, and once they were happy they could hit 'download PDF' to get a PDF version.
Achieved this by (admittedly slightly clunky way) of sucking the SVG out of the chart and sending it to the server via ajax. Server intercepts SVG and passes it to inkscape which does pretty good command line svg -> pdf... then, sends back completed PDF.
One gotcha is that you won't get any CSS this way, so all styling has to be done via SVG props.
Also note how the author's tagline is 'javascript clickbait enthusiast' :-)