Better way to handle exceptions?

I am in the process of converting some powerpoint files given to me into pdfs. We are getting the following exception:


Value cannot be null.
Parameter name: encoder

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 ?.?.??(GraphicsPath graphicsPath, ? lineParam, ? fillParam)
at Aspose.Slides.Ellipse.?(? canvas, ArrayList rotations,  renderingContext)
at Aspose.Slides.GroupShape.?(? 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)

Is there a better way to have the library handle internal exceptions like this? In our case it would be better not to output a specific slide into the output pdf, but still output everything else that it can, than to just get a fatal error because of this.

The code I’m using is:

var slideLic = new Aspose.Slides.License();
slideLic.SetLicense( “Aspose.Total.lic” );
var presentation = new Presentation( InputFile );
presentation.Save( newfile, Aspose.Slides.Export.SaveFormat.Pdf );

Thanks.


Hi Andre,


I have observed your requirements and regret to share that unfortunately there is no option available to handle internal exception. At the moment if there is any issue in PDF then it will be either exported to PDF or if there is issue then not. An issue with ID SLIDESNET-33757 has been created in our issue tracking system to resolve the issue. I have also requested our development team to see if it is possible to handle internal exception or not. I will share the further information with you as soon as it will be shared by our development team.

We are sorry for your inconvenience,