PptxReadException: Parameter is not valid on exporting PPTX with images to PDF (C# .NET)

TestFile.zip (32.2 KB)
Hi All,

Our team now facing an error when trying to convert pptx file contain some picture (attached file) to pdf for previewing, could you please give us some advice, below is the information regrading this error:

  • Aspose version we are using have SubscriptionExpiry on 2015/11/07
    Aspose.Pdf version : 10.9.0
    Aspose.Slides for .NET version : 15.9.0

  • C# code : Exception from this block of code
    using (var ms = new MemoryStream(binary))
    {
    var amaDocType = Aspose.DocumentTypeManager.GetType(@this.Label);
    //This one crach if cannot preview
    Preview.PageCount(ms, amaDocType); <-- Error
    return true;
    }

  • Exception message :
    {Aspose.Slides.PptxReadException: Parameter is not valid. —> System.ArgumentException: Parameter is not valid.
    at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
    at Aspose.Slides.ImageCollection.AddImage(MemoryStream stream)
    at Aspose.Slides.ImageCollection.AddImage(Byte[] buffer)
    at .( )
    at .( )
    at .( , IPresentation )
    at .(Presentation , Stream )
    — End of inner exception stack trace —
    at .(Presentation , Stream )
    at Aspose.Slides.Presentation.(Stream )
    at Aspose.Slides.Presentation.(Stream )
    at Aspose.Slides.Presentation…ctor(Stream stream, LoadOptions loadOptions)
    at Amaris.Aspose.Preview.PreviewPowerpoint.get_Presentation()
    at Amaris.Aspose.Preview.PreviewPowerpoint.PageCount()
    at Amaris.Document.WepApp.Extensions.DocumentExtensions.IsPreviewable(AmarisDocument this, Byte[] binary) in

@VoVanHai,

I have worked with source file shared by you using Aspose.Slides for .NET 19.5 and unable to observe any issue. I have also shared my generated result with you for your kind reference. Please check attachment. Can you please try to use latest version on your end. TestFile.pdf (26.7 KB)

thank for your help Admad, we are conserding to replace Aspose Total .Net to GroupDocs Total .Net so we have a few question regarding that. For now, we are using Apose for previewing image, pdf, MS Office, signing document (add signature image to pdf file), etc. Do you think Groupdocs can replace Aspose for those kind of behaviors or which one better for our case. thanks

@VoVanHai,

I have observed your requirements related to Aspose.Groupdocs and moving this to concerned forum where our respective support team will assist you further.

This topic has been moved to the related forum: How to convert PPTX file contain images to PDF in .NET - Free Support Forum - groupdocs.com