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

Free Support Forum - aspose.com

Exception in PPTX document to PDF convertion

Hi,

I’m well and truly stumped!
I’m having an issue with the convertion for pptx document to pdf the exception message is:

Aspose.Slides.Presentation ppt = new Aspose.Slides.Presentation(fs);
ppt.Save(outputforpdf, Aspose.Slides.Export.SaveFormat.Pdf);

Stream length must be non-negative and less than 2^31 - 1 - origin.
Parameter name: offset

at System.IO.MemoryStream.Seek(Int64 offset, SeekOrigin loc)
at Aspose.Slides. .(Byte[] )
at Aspose.Slides. .(Byte[] , )
at Aspose.Slides. …ctor(Byte[] )
at Aspose.Slides. .(Byte[] )
at Aspose.Slides. …ctor( , Byte[] , , )
at Aspose.Slides.​ .(Byte[] , , )
at Aspose.Slides. .(Byte[] , , RectangleF , , Boolean )
at Aspose.Slides. .(​ )
at Aspose.Slides.​ .36gb8j2pxayk423lsm4qwj9yq55a7hwh ​ (​ )
at Aspose.Slides. ​ .lhrksw4qmpxsb9gbrklg24zzqz43kn79 ​ ( ​ , )
at Aspose.Slides. ​ .lhrksw4qmpxsb9gbrklg24zzqz43kn79 ​ ( ​ , )
at Aspose.Slides. ​ .lhrksw4qmpxsb9gbrklg24zzqz43kn79 ​ ( ​ , )
at Aspose.Slides. ​ .lhrksw4qmpxsb9gbrklg24zzqz43kn79 ​ ( ​ , )
at Aspose.Slides. ​ .lhrksw4qmpxsb9gbrklg24zzqz43kn79 ​ ( ​ , )
at Aspose.Slides.​ .lhrksw4qmpxsb9gbrklg24zzqz43kn79 ​ ( ​ , )
at Aspose.Slides.​ .( ​ , )
at Aspose.Slides. .(Presentation , Stream , Int32[] , PdfOptions , InterruptionToken )
at Aspose.Slides. .(Presentation , Stream , PdfOptions , InterruptionToken )
at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options)
at PwC.C4.Ants.Controllers.FileController.TransferToPDFByStream(String formId, String fileids, String fieldName, String pdfid, String env)

The original file is :Error.zip (290.3 KB)

@rachel.liu,

I have observed the information shared by you and like to share that you need to set the stream position to 0 before loading using Presentation object. Please also try using latest Aspose.Slides for .NET 18.10 as well on your end.

Hi Mudassir,

we change the code like this:
fs.Position = 0;
Aspose.Slides.Presentation ppt = new Aspose.Slides.Presentation(fs);
ppt.Save(outputforpdf, Aspose.Slides.Export.SaveFormat.Pdf);

And we update the Aspose.Sliders to 18.10.0.0.
(C:\LSD\vProject\Ants\V2.3\Source Code\packages\Aspose.Slides.NET.18.10.0\lib\net4.0-client\Aspose.Slides.dll)

But it still not working.

Before this code, we already set the position to 0.

MemoryStream fs = new MemoryStream();
data[0].MemoryStream.Position = 0;
fs.Write(data[0].MemoryStream.ToArray(), 0, data[0].MemoryStream.ToArray().Length);

@rachel.liu,

I have worked with source files and sample code shared by you and have been able to observe the issue. A ticket with ID SLIDESNET-40646 has been created in our issue tracking system to further investigate issue in detail. This thread has been linked with issue so that you may be automatically notified once issue will be fixed.

The issues you have found earlier (filed as SLIDESNET-40646) have been fixed in this update.