Hi, when creating a PDF-document with Aspose.Slides in our IIS Web-Server we get exceptions after about half a day of operation. There are two phenomena occurring:
- sometimes we get a GDI+ Exception from inside your Aspose.Slides Component (see Stacktrace below)
- sometimes we don’t get an exception but the images from the presentation are missing, which is even worse, because we can hardly find out whether an error actually occurred. Currently we check the size of the resulting PDF and if it is considerably smaller than the PPTX we assume that this exception occurred.
After recycling of the application pool (our software is hosted in Microsoft IIS) everything works fine for a while; the same document that provoked the error can be generated without errors until the process seems to become corrupt and the same error occurs every time.
Do you have an idea, what could be the reason? We are using AsposeSildes 17.2.0.0.
Do you need further information from us?
Thanks in advance!
This is our Routine to convert Powerpoint Slides to PDF:
public static byte[] PptxAsPdf(byte[] pptxBytes, bool generatePdfA, PdfFormat pdfFormat, ITrace trace)
{
lock (_wordLock)
{
Presentation presentation;
using (var pptxStream = new MemoryStream(pptxBytes))
{
presentation = new Presentation(pptxStream, new Aspose.Slides.LoadOptions(Aspose.Slides.LoadFormat.Auto));
}
var pdfOptions = new PdfOptions
{
SaveMetafilesAsPng = false
};
using (var pdfStream = new MemoryStream())
{
presentation.Save(pdfStream, Aspose.Slides.Export.SaveFormat.Pdf, pdfOptions);
return ConvertStreamToPdfA(pdfStream, generatePdfA, pdfFormat, trace);
}
}
}
This is the Exception we sometimes get
=== [MESSAGE:] ‘A generic error occurred in GDI+.’
=== [SOURCE:] ‘System.Drawing’
=== [TARGETSITE:] ‘Void Save(System.IO.Stream, System.Drawing.Imaging.ImageCodecInfo, System.Drawing.Imaging.EncoderParameters)’
=== [CALLSTACK:]
=== at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
=== at
. .(Image image, Stream stream)
=== at
. .[1] (Stream stream)
=== at [1].[1]…ctor([1] context, brush)
=== at [1].¬[1].( brush, [1] context)
=== at [1]. [1]. ( brush)
=== at [1].[1]. ( brush, Boolean isStroking)
=== at [1].[1].([1] path)
=== at [1].[1].([1] visitor)
=== at [1].[1].([1] visitor)
=== at [1]. [1].([1] visitor)
=== at [1].[1].([1] visitor)
=== at [1].[1].([1] visitor)
=== at [1].[1].SaveToPdf(PresentationEx pres, Stream stream, PdfOptions options)
=== at Aspose.Slides.Pptx.PresentationEx.Save(Stream stream, SaveFormat format, SaveOptions options)
=== at Lpa.DocFramework.AsposeWrapper.PdfUtils.PptxAsPdf(Byte[] data, Boolean genPdfA, ITrace trace)