I am trying to open a presentation from a MemoryStream. I create the MemoryStream from a byte array read from a Database. When trying to create the presentation I recieve "Unable to read entire header; 0 bytes read; expected 512 bytes" I can write the same stream out to the response stream and open the PPT file.
Code:
MemoryStream str = new MemoryStream();
fileBytes = Section.getSlides( sectionID ); //this is the byte array from the database.
str.Write( fileBytes , 0 , size );
//works with lower line commented out! Uncommented throws an error.
Aspose.Slides.Presentation SlideSet = new Aspose.Slides.Presentation( str );
HttpContext.Current.Response.ContentType = "application/vnd.ms-powerpoint";
Response.AddHeader( "Content-Disposition" , "attachment;filename=Values Presentation" );
str.WriteTo( Response.OutputStream ); // the stream is fine!
Response.Flush();
str.Close();
I am using version 2.8.9.0 of the Aspose.Slide dll - unlicensed at this point.
Am I missing something?
Thanks!
Updated Information:
I am able to Create a Presentation Object with a FileStream linking to the same file on disk, but not with the MemoryStream opening the file from the database.
Should I be able to use MemoryStream?
Thanks!