Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kendo ui 使用MemoryStream导出KendoUI图表_Kendo Ui_Kendo Asp.net Mvc_Inkscape - Fatal编程技术网

Kendo ui 使用MemoryStream导出KendoUI图表

Kendo ui 使用MemoryStream导出KendoUI图表,kendo-ui,kendo-asp.net-mvc,inkscape,Kendo Ui,Kendo Asp.net Mvc,Inkscape,我在github上发现了这个有用的repo,它是一个kendoui示例,使用Inkscape将图表中的数据发布到mvc控制器,将svg输出为pdf或png 它会在App_数据文件夹中创建一个临时svg文件和png,如果您对文件留在那里感到满意,那么就可以了 主要的优点就发生在这段代码中 private string DoExport(string svgFile, ExportFormat format) { var extension = format == Expo

我在github上发现了这个有用的repo,它是一个kendoui示例,使用Inkscape将图表中的数据发布到mvc控制器,将svg输出为pdf或png

它会在App_数据文件夹中创建一个临时svg文件和png,如果您对文件留在那里感到满意,那么就可以了

主要的优点就发生在这段代码中

 private string DoExport(string svgFile, ExportFormat format)
    {
        var extension = format == ExportFormat.PNG ? "png" : "pdf";
        var outFile = TempFileName() + "." + extension;

        // Full list of export options is available at
        // http://tavmjong.free.fr/INKSCAPE/MANUAL/html/CommandLine-Export.html
        var inkscape = new 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;
    }
在inkscape之后。开始;运行在app_数据文件夹中创建的png文件,并从方法返回app_数据图像的路径

可以在内存中执行所有操作并返回带有actionresult的图像,而不是创建文件吗

[HttpPost]
    public ActionResult _Export(string svg, 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" + Path.GetExtension(outFile);

        return File(outFile, MimeTypes[format], attachment);
    }
我不知道如何做到这一点,如果它可以做到