Free Support Forum -

Converting PPT to PDF causes ArgumentNullException

Hi there,

I’m trying to convert a PPT file I have to PDF using the code below. This causes an ArgumentNullException with the message “Value cannot be null, Parameter name: encoder”. Full stack trace is below. I also noticed that the stacktrace sometimes have garbled characters, causing our logging mechnism to not able to log. We’ve seen this in Slides and Words.

Presentation presentation = new Presentation(fileName);
presentation.Save(convertedFileName, Aspose.Slides.Export.SaveFormat.Pdf);

Stack Track:

at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(Stream stream, ImageFormat format)
at ?.??.?( fillParam, Single dpi)
at ?.??.?(RectangleF rectangle,  lineParam,  fillParam)
at Aspose.Slides.Rectangle.?(?? canvas, ArrayList rotations, ? renderingContext)
at Aspose.Slides.Slide.?(?? canvas, SaveOptions options)
at Aspose.Slides.Slide.?(Boolean saveMetafileAsPng, SaveOptions options)
at ?.??.SaveToPdf(Presentation pres, Stream stream, Int32[] slides, PdfOptions options, Boolean notesView)
at ?.??.SaveToPdf(Presentation pres, Stream stream, Int32[] slides, PdfOptions options)
at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, SaveOptions options)
at Aspose.Slides.Presentation.Save(String fname, SaveFormat format)
at TestConsoleApp.Program.testSlides2() in D:\svn\RivetCloud\server\RivetTranscode\TestConsoleApp\Program.cs:line 71
at TestConsoleApp.Program.Main(String[] args) in D:\svn\RivetCloud\server\RivetTranscode\TestConsoleApp\Program.cs:line 34
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Hi Ed,

Thanks for your interest in Aspose.Slides.

I have worked with the presentation file shared by you and have been able to observe the issue specified. An issue with ID SLIDESNET-33769 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

Is there any resolution to this issue? This does not happen for all PPT files and is affecting one of my client’s production systems. Upgrading to also does not address the issue.

This does not seem to be happening for PPTX files, but I haven’t tested this deeply.

Converting to PPTX then to PDF from there seems to work, but the expected output formatting gets messed up and so is an unacceptable workaround.

Hi ED,

I like to share that I have verified the issue using Aspose.Slides for .NET 6.7.0 on my end before adding the issue in our issue tracking system. Unfortunately, at the moment I am unable to share any work around as this issue has been observed using latest available version. I will really appreciate your patience till the time our development team may schedule and resolve the issue.

Many Thanks,

Hi there,

are there any updates on this topic?

Best Regards, Daniel

Hi Daniel,

I have tested the presentation with Aspose.Slides for .NET 7.1.0 and have found issue to be resolved. Can you please try using the specified version. I have also shared the generated PDF for your kind refernece.

Many Thanks,