hello community,
I try to export Chart as PDF: when i write
string documents = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);chart.RenderPdfFriendlyGraphics(g);
report.Publish(documents + "\\report.pdf", FileFormat.PDF); it works very well. But my problem i use asp.net mvc and want via Controller to export Chart:
var PieChart = new UltraChart();
........
var stream = new System.IO.MemoryStream();new ExportToPDF().Export(PieChart, stream);return new File(stream, "application/pdf", "report.pdf");
in my class ExportToPDF: report.Publish(stream, FileFormat.PDF) and with possibility i get empty File (report.pdf)
Thanks for reply and help
does the stream.Length property return 0 before you try to write to a file?
you might need to call stream.Flush() at that point.
Thanks David for your reply.
It work now, after new ExportToPDF() method i write response.BinaryWrite(stream.ToArray()); ...
Thanks