Can't Convert Presentations to PDF, JPG with .Net 5.0 on Linux

Hi,
I used Aspose.Slides.Net 21.11 to convert PPT to PDF, PPTX to JPG, PPTM to JPG on Linux with .Net 5. With these samples file ppt.zip (2.5 MB)
pptx.zip (5.1 MB)
pptm.zip (9.9 MB)
the application crash or throw exception.
Environment:
Ubuntu 18.04
Net5
Aspose.Slides.Net 21.11
msttcorefonts, libgdiplus 6.0.5 installed.
The code I used:
PPT -> PDF:
using var presentation = new Presentation(inFile);
SaveFormat format = SaveFormat.Pdf;
presentation.Save(tempFile, format);
PPTX, PPTM -> JPG:
using var presentation = new Presentation(inFile);
var options = ImageFormat.Jpeg;
for (int i = 0; i < presentation.Slides.Count; i++)
{
var sld = presentation.Slides[i];
var bmp = sld.GetThumbnail(1f, 1f);
string slideName = Path.Combine(outputFolder, $“Slide{i + 1}.jpg”);
bmp.Save(slideName, options);
}
Can you investigate this issue and give me some advice?

Here is detail infos for each file:
ppt_to_pdf_1.ppt: Exception was thrown
Out of memory.
at System.Drawing.SafeNativeMethods.Gdip.CheckStatus(Int32 status)
at System.Drawing.Image.InitializeFromStream(Stream stream)
at System.Drawing.Image.LoadFromStream(Stream stream, Boolean keepAlive)
at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement)
at System.Drawing.Image.FromStream(Stream stream)
at Aspose.Slides.PPImage.()
at .( ​ , & , IFillParamSource )
at .( ​ , & , IFillParamSource )
at .( ​ , & , IFillParamSource )
at .( ​ , IFillParamSource[] )
at …ctor( ​ , IFillParamSource[] )
at Aspose.Slides.BaseSlide.(Background , ShapeFrame , , )
at Aspose.Slides.Slide.( , IShapeFrame , , , InterruptionToken )
at Aspose.Slides.Slide.( , , , InterruptionToken )
at Aspose.Slides.Slide.(Boolean , , , SortedList`2 , InterruptionToken )
at .(Presentation , Stream , Int32[] , PdfOptions , InterruptionToken )
at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options)
at Aspose.Slides.Presentation.Save(String fname, SaveFormat format)
at CoreTester.Program.Main(String[] args) in D:\TempProject\CoreTester\Program.cs:line 53

ppt_to_pdf_2.ppt: Crashed
No useful message.

ppt_to_pdf_3.ppt: Exception was thrown
Out of memory.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y, Int32 width, Int32 height)
at System.Drawing.Bitmap…ctor(Image original, Int32 width, Int32 height)
at ​ .(​​ , SizeF , )
at .(​ , ​​ , )
at .( ​ , & , IFillParamSource )
at .( ​ , & , IFillParamSource )
at .( ​ , & , IFillParamSource )
at .( ​ , IFillParamSource[] )
at …ctor( ​ , IFillParamSource[] )
at Aspose.Slides.BaseSlide.(Background , ShapeFrame , , )
at Aspose.Slides.Slide.( , IShapeFrame , , , InterruptionToken )
at Aspose.Slides.Slide.( , , , InterruptionToken )
at Aspose.Slides.Slide.(Boolean , , , SortedList`2 , InterruptionToken )
at .(Presentation , Stream , Int32[] , PdfOptions , InterruptionToken )
at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options)
at Aspose.Slides.Presentation.Save(String fname, SaveFormat format)
at CoreTester.Program.Main(String[] args) in D:\TempProject\CoreTester\Program.cs:line 53

pptm_to_jpg_1.pptm: Exception was thrown
A generic error occurred in GDI+.
at System.Drawing.SafeNativeMethods.Gdip.CheckStatus(Int32 status)
at System.Drawing.Graphics.set_Transform(Matrix value)
at ​ . ​ (​​ )
at .(​​ )
at .()
at Aspose.Slides.Slide.( , IShapeFrame , , , InterruptionToken )
at Aspose.Slides.Slide.GetThumbnail(Size imageSize)
at Aspose.Slides.Slide.GetThumbnail(Single scaleX, Single scaleY)
at CoreTester.Program.Main(String[] args) in D:\TempProject\CoreTester\Program.cs:line 46

pptm_to_jpg_2.pptm: Crashed
ERROR:region.c:1919:GdipIsVisibleRegionPoint: assertion failed: (region->bitmap)

pptx_to_jpg_1.pptx: Crashed
ERROR:region.c:1919:GdipIsVisibleRegionPoint: assertion failed: (region->bitmap)

pptx_to_jpg_2.pptx: Crashed
ERROR:region.c:1919:GdipIsVisibleRegionPoint: assertion failed: (region->bitmap)

@dunghnguyen,
It will take me a while to check all cases. I will reply to you as soon as possible.

@dunghnguyen,
I have added tickets with the following IDs in our issue tracking sustem:

  • SLIDESNET-42935 (“Out of memory” exception is thrown when converting PPT to PDF)
  • SLIDESNET-42936 (PPT to PDF convertion crashes without messages)
  • SLIDESNET-42937 (“Out of memory” error is thrown when converting PPT to PDF)
  • SLIDESNET-42938 (“A generic error occurred in GDI+” error when converting PPTM to JPEG)
  • SLIDESNET-42939 (PPTM/PPTX to JPG convertion crashes)

Our development team will investigate these cases. You will be notified when the issues are resolved.

1 Like

The issues you have found earlier (filed as SLIDESNET-42939,SLIDESNET-42938,SLIDESNET-42937,SLIDESNET-42936,SLIDESNET-42935) have been fixed in Aspose.Slides for .NET 22.2 (ZIP, MSI).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.