I need to include a high graph chart in a PDF report. But how can I get the image / png created by export.highcharts.com? This is what I have done so far:
When a button is clicked, this ajax request is launched:
$.ajax({ url: "Home/Teste", type: "POST", dataType: "html", data: { svgParam: myChart.getSVG() }, success: function (data) { doStuff(data); }});
On the server, I receive a request and process:
[HttpPost] [ValidateInput(false)] public void Teste(string svgParam) {
svgParam is an html line with content like this:
I get this svgParam in asp.net without any problems. But the answer from export.highcharts.com is always the same, as if te svg had not been sent:
<body> <div id="top"> <a href="http://www.highcharts.com" title="Highcharts Home Page" id="logo"><img alt="Highcharts Home Page" src="resources/Highcharts-icon-160px.png" border="0"></a> <h1>Highcharts Export Server</h1> </div> <div id="wrap"> <h3>Oops..,</h3> <p>The manadatory svg POST parameter is undefined.</p> </div> </body>
For testing, I created another method in my application to get this WebRequest as follows:
[HttpPost] [ValidateInput(false)] public void Teste2(string filename, string type, string width, string svg) { string whereIsMySvg = svg; }
Received parameters filenam, type and width. But svg one is null. I tried to encode, not encode, serialize as a json string, change the content type ... and nothing, the svg parameter never gets to the destination.
Any ideas?