PDA

View Full Version : Send a chart per mail... How?



Dumbledore
4 Dec 2012, 11:14 AM
For an intranet application i need a way to send a sencha chart per mail. Because this app has no connection to the internet it must be a php way.

Any ideas except phantomjs?

Bye, Dumbledore

existdissolve
4 Dec 2012, 3:14 PM
I've done something similar in my intranet app. When saving the chart, I use type "image/svg+xml". Then, I post the svg content to my server, where some utilities convert the svg/xml to a .png file which can be downloaded, emailed, whatever.

Here's the code from my controller:



saveChart: function( btn, e, opts ) {
var me = this,
window = btn.up( 'window' ),
chart = window.down( 'chart' ),
formEl = Ext.get(document.createElement('form')),
svgEl = Ext.get(document.createElement('input')),
svgContent;

svgContent = chart.save({
type: 'image/svg+xml'
});
formEl.set({
action: 'reports/savechart',
method: 'POST',
target: '_blank'
});
svgEl.set({
name: 'svg',
type: 'hidden',
value: svgContent
});
formEl.appendChild(svgEl);
Ext.getBody().appendChild(formEl);
formEl.dom.submit();
}

Dumbledore
4 Dec 2012, 10:05 PM
cool... can you recommend server side tools for convert svg to png?

Thanks!

Dumbledore

existdissolve
4 Dec 2012, 10:06 PM
cool... can you recommend server side tools for convert svg to png?

Thanks!

Dumbledore

This is one I've had luck with: http://xmlgraphics.apache.org/batik/

Good luck!