Error when Opening Powerpoint

I am trying to open a powerpoint presentation using the following code:

private System.IO.MemoryStream SavePptAsPdf(System.IO.MemoryStream Orig_File)

{
Aspose.Slides.Presentation ppt;
Aspose.Slides.License license_PowerPoint;
System.IO.MemoryStream stream;

try
{
//license
license_PowerPoint = new Aspose.Slides.License();
license_PowerPoint.SetLicense("Aspose.Total.lic");
//end license

ppt = new Aspose.Slides.Presentation(Orig_File);
stream = new System.IO.MemoryStream();
ppt.SaveToPdf(stream);

return stream;

}

On the line highlighted in yellow (Note the input is a memory stream) I get the following error message:
System.IndexOutOfRangeException: Index was outside the bounds of the array.

Attached to this post is the simple power point test we are using.

Is anyone from Aspose monitoring and responding to these questions?

Hello,

I am unable to reproduce the error with Aspose.Slides 3.0.1.15296.

This is a version of Slides that is not yet released?

It is a minor release not a major, but you can use it.

I am still getting the same error with the new version.

Did you set stream position to 0 before creating Presentation object?

I did not, I have not had to do that with any of the other file types (Word, Excel…) also I have not done anything with the stream yet so shouldn’t it be at position 0 already?

It depends on how this MemoryStream was created. If you created it from byte array then position should be at 0. But if you wrote data to the stream and try to read it back with Presentation constructor then it can’t be at 0.

Since we tested your presentation with latest version of Aspose.Slides and there are no problems then most probably something wrong with the stream. Another possible reason is Aspose.Slides wasn’t updated properly and your application still use old version.

Looks like the position was the problem. I am not sure why its different for this one file type but it is.


Thanks