0

I have a question regarding generating an SVG instead of an PNG serverside using PhantomJS. I have PhantomJS running as a server and am POSTing JSON to it (http://www.highcharts.com/docs/export-module/render-charts-serverside). I would like to receive an SVG represented as a BASE64 result stream. I am running in some problems however.

I tried both the following requests, but the base64 result would always represent a png file:

{"infile":".......", "type":"image/svg+xml"}

And:

{"infile":".......", "type":"svg"}

I do however get a valid svg file when I use the outfile parameter:

{"infile":".......", "type":"svg", "outfile":"anActualSVG.svg"}

This writes a file to disk, which is not what I am looking for.

Does anyone have some suggestions?

Thanks!

Waterstraal
  • 399
  • 4
  • 16
  • Try to remove type parameter. Then base64 string should be returned – Paweł Fus Feb 04 '14 at 12:42
  • But that Base64 string would be an PNG and not a SVG... I would like it to be an SVG – Waterstraal Feb 06 '14 at 12:21
  • I see! Unfortunately, you need to edit highcharts-convert.js file - returned SVG parsed to base64. [This question](http://stackoverflow.com/questions/246801/how-can-you-encode-a-string-to-base64-in-javascript) should help you. – Paweł Fus Feb 06 '14 at 14:05

0 Answers0