Saving Aspose PDF MemoryStream as PPT to SharePoint O365

Hi,



Saving Aspose PDF MemoryStream as PPT to SharePoint O365 List item gets corrupted unable to view the ppt.



if the same ppt saved locally with memory stream and path gets saved and renders properly in SharePoint



Aspose.Pdf.Document OutPutDocument = null;

Aspose.Pdf.PptxSaveOptions pptx_save = null;

MemoryStream pdfMemoryStream = new MemoryStream();



MemoryStream intputMemStream = new MemoryStream();

inputStream.CopyTo(intputMemStream);

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(intputMemStream);

OutPutDocument = new Aspose.Pdf.Document();

pptx_save = new Aspose.Pdf.PptxSaveOptions();



// Save resulting PDF document.

OutPutDocument.Save(pdfMemoryStream,SaveFormat.Pptx);

OutPutDocument.Save(pdfMemoryStream,pptx_save);





saving pdfMemoryStream memory stream as ppt to sharepoint gets corrupted

Team,

Any updates need a response as this awaits some production deployment

Thanks

Hi there,

Thanks for your inquriy. Please set resultant PPTX stream position back to 0 before using it. Furthermore, please note while using PptxSaveOptions then you do not need to use SaveFormat parameter. Please check sample code snippet as below, hopefully it will help you to accomplish the task.

Aspose.Pdf.Document OutPutDocument = null;

Aspose.Pdf.PptxSaveOptions pptx_save = null;

MemoryStream pdfMemoryStream = new MemoryStream();

MemoryStream inputStream = new MemoryStream(File.ReadAllBytes(myDir + "HelloWorld.pdf"), true);

MemoryStream intputMemStream = new MemoryStream();

inputStream.CopyTo(intputMemStream);

//Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(intputMemStream);

OutPutDocument = new Aspose.Pdf.Document(intputMemStream);

pptx_save = new Aspose.Pdf.PptxSaveOptions();

// Save resulting PDF document.

OutPutDocument.Save(pdfMemoryStream, pptx_save);

pdfMemoryStream.Position = 0;

Best Regards,

Thanks team it works now

Hi there,


Thanks for the acknowledgement, It is good to know that your issue has been resolved.

Please keep using our APIs and feel free to contact us for any further assistance.

Best Regards,