예제 #1
0
        public FileContentResult GetAuthorKpiChartImage(AuthorStatementRequestToken request)
        {
            var items = _reportServices.GetStatementKpiData(request);

            var svgText = RenderRazorViewToString("_AuthorKpiChart", items);


            var bytes = Encoding.ASCII.GetBytes(svgText);

            using (var stream = new MemoryStream(bytes))
            {
                var svgDocument = SvgDocument.Open(svgText);
                var bitmap      = svgDocument.Draw();
                bitmap.Save(stream, ImageFormat.Png);
                var imageBytes = stream.ToArray();

                return(new FileContentResult(imageBytes, "image/png"));
            }
        }