i am trying to get Telerik Kendo Charts to png or pdf with Inkspace 0.48 Windows 8.1 version.
Related topic:
http://www.telerik.com/forums/kendo-chart-to-jpg
But i have a problem with Chart's Title. I am using Turkish characters and i can't show Turkish characters on title section. How can i solve this problem?
I have installed Inkscape to my computer. Is there a trick about Inkscape related to Inkscape preferences or something like that?
I upload a picture of situation. I need to see "ç" and "ü" characters.
Thank you.
//here is the code which i use:
Code: Select all
private const string INKSCAPE_PATH = @"C:\Program Files (x86)\Inkscape\inkscape.exe";
private const int WIDTH = 800;
private const int HEIGHT = 600;
private readonly Dictionary<KendoChartExport.Models.ExportFormat, string> MimeTypes = new Dictionary<KendoChartExport.Models.ExportFormat, string>
{
{ KendoChartExport.Models.ExportFormat.PNG, "image/png" },
{ KendoChartExport.Models.ExportFormat.PDF, "application/pdf" }
};
[HttpPost]
public ActionResult _Export(string svg, KendoChartExport.Models.ExportFormat format)
{
var svgText = HttpUtility.UrlDecode(svg);
var svgFile = TempFileName() + ".svg";
System.IO.File.WriteAllText(svgFile, svgText);
var outFile = DoExport(svgFile, format);
var attachment = "export" + System.IO.Path.GetExtension(outFile);
return File(outFile, MimeTypes[format], attachment);
}
private string DoExport(string svgFile, KendoChartExport.Models.ExportFormat format)
{
var extension = format == KendoChartExport.Models.ExportFormat.PNG ? "png" : "pdf";
var outFile = TempFileName() + "." + extension;
var inkscape = new System.Diagnostics.Process();
inkscape.StartInfo.FileName = INKSCAPE_PATH;
inkscape.StartInfo.Arguments =
String.Format("--file \"{0}\" --export-{1} \"{2}\" --export-width {3} --export-height {4}",
svgFile, extension, outFile, WIDTH, HEIGHT);
inkscape.StartInfo.UseShellExecute = true;
inkscape.Start();
inkscape.WaitForExit();
return outFile;
}
private string TempFileName()
{
return System.IO.Path.Combine(Server.MapPath("~/App_Data"), System.IO.Path.GetRandomFileName());
}
#endregion
}