Click here to Skip to main content
15,881,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i am trying to get Kendo Charts to png or pdf with Inkspace.

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?

Thank you.

CSS
Inkspace forum link with images.
http://www.inkscapeforum.com/viewtopic.php?f=16&t=17630&p=65101#p65101

Kendo Link
http://www.telerik.com/forums/kendo-chart-to-jpg

Command Line Export.
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/CommandLine-Export.html

Thank you.



//here is the code:

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


   }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900