Notes and anecdotes

Techstuff rambling

Converting SVG to PNG with Javascript cross browser

I promise I tried to do it with client-side Javascript only. And I promise I won’t try again before 2020. Google returns so many optimistic answers, that on the bottom has a disclaimer: “This does not work with Safari”, or “This crashes IE9”, or just no disclaimer. But don’t believe  them:

It can’t be done. JUST FORGET IT. It’s like adjusting your HTML newsletter to look good in all versions of Outlook. It’ll just make you kill yourself. Instead, do it server side:

With JavaScript and Node you can rely on PhantomJS to convert it consistently, or with Java you can use org.apache.batik.transcoder.

GIST: Java server side converting svg to svg/png file using batik.


tomfa • 2016-07-20

Previous Post

Next Post