We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert PowerPoint file to PDF in Aspose.Slides Version

I am trying to convert powerpoint file to PDF using below method.

public MemoryStream ConvertPowerPointToPDF(MemoryStream stream)
MemoryStream pdfStream = new MemoryStream();

//Save the document in Pdf format
// Create a new memory stream.
MemoryStream outStream = new MemoryStream();

// Aspose.Words.Document doc = new Aspose.Words.Document(stream);
Aspose.Slides.Presentation pres = new Aspose.Slides.Presentation(stream);
pres.Save(outStream, Aspose.Slides.Export.SaveFormat.Pdf);

// Convert the document to byte form.
byte[] docBytes = outStream.ToArray();

// The bytes are now ready to be stored/transmitted.
// Now reverse the steps to load the bytes back into a document object.
pdfStream = new MemoryStream(docBytes);
// wordLicense.SetLicense("");
// pdfLicense.SetLicense("");
return pdfStream;

But it is giving below error at below line
Aspose.Slides.Presentation pres = new Aspose.Slides.Presentation(stream);

Error Message
"Index was outside the bounds of the array."

I am trying to convert using stream.

Aspose.Slides Version :

Hi Rob,

I have observed the sample code shared by you and request you to please try following statement after pres.Save() method call.


I hope this will be helpful. Please share, if I may help you further in this regard.

Many Thanks,