Page 1 of 1

getting 'System.IO.InvalidDataException' while loading byte array to the report

Posted: Mon Oct 04, 2010 3:42 pm
by snair
Am getting below exception error while trying to load a byte array to the report. Please let me know how can I resolve the problem. Appreciate a help

Exception Error
An unhandled exception of type 'System.IO.InvalidDataException' occurred in Stimulsoft.Report.dll
Additional information: The magic number in GZip header is not correct. Make sure you are passing in a GZip stream.

Here is the code snippet am using..
System.Windows.UIElement element = (System.Windows.UIElement)this.ImageCanvas.cadImage; (P.S : this is an image)
buffer = element.ToBitmap(15, 15).ToPNGBytes();
StiReport report = new StiReport();
report.Load(buffer);
report.ShowWithWpf();



getting 'System.IO.InvalidDataException' while loading byte array to the report

Posted: Tue Oct 05, 2010 4:00 am
by Alex K.
Hello,

Maybe we did not exactly understand your question.
Method report.Load() loads a report template, and you try to load an image instead of it (as we understand from your code).
Could you explain your issue in more details?

Thank you.

getting 'System.IO.InvalidDataException' while loading byte array to the report

Posted: Tue Oct 05, 2010 9:02 am
by snair
Report Load function takes byte array or stream type parameters... so i was thinking an image can be loaded like that

getting 'System.IO.InvalidDataException' while loading byte array to the report

Posted: Wed Oct 06, 2010 2:39 am
by Alex K.
Hello,

You can create a report, place an image on it, load the image into the report using the code and with the help of the report.Load() to load the report.

Thank you.