Getting Image Export failed while converting png to pdf

I am getting below error while Converting PNG file into pdf

Error:
System.InvalidOperationException: Failed to convert document to PDF: Image export failed. —> Aspose.Imaging.CoreExceptions.ImageSaveException: Image export failed. —> #=zuiOqstwvoe84KU4J5b13dNE=: Bad state (invalid block type) at #=ztXDBf4a8pGssZ0JqIgvGWjz3OFwwaHVfFeEkAvlR1IB1fj$vgAJ_yI8=.#=z71n4AnfU0ER2(Rectangle #=zE$G$ZOU=, IPartialRawDataLoader #=zWFcSRJbBmGd7, #=zLGbcIsTXCZgUXlFXrijs7I3c36SiE6lVIb9mrhkGZrLGNPH3IGDxVt0ZbuRW1JzKiw== #=zEOlE_90_S2xhwL6fk0xS4KI=) at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr) at dje_qW2GC9FBJW8QE2E3JQMWNWH5VVKE6YQQ76G9Q3SMK77WRF8CDGXLA_ejd.#=zTJIpicTQBi5mPUIHP1KJj92qa9kq(Object #=zm5mtfKI=) at dje_qW2GC9FBJW8QE2E3JQMWNWH5VVKE6YQQ76G9Q3SMK77WRF8CDGXLA_ejd.#=zFwUiZTMsVWm74VDJ6kWnfBSJp8Z8(Object #=zm5mtfKI=) at dje_qW2GC9FBJW8QE2E3JQMWNWH5VVKE6YQQ76G9Q3SMK77WRF8CDGXLA_ejd.#=zpjwKNHsekz0850beM6T4ICA=(MethodBase #=zm5mtfKI=, Boolean #=zm9UlLKg=) at dje_qW2GC9FBJW8QE2E3JQMWNWH5VVKE6YQQ76G9Q3SMK77WRF8CDGXLA_ejd.#=zbqftAj508E1flyi0IbNjX4MedEuIwfsBvg==(dje_qW2GC9FBJW8QE2E3JQMWNWH5VVKE6YQQ76G9Q3SMK77WRF8CDGXLA_ejd #=zm5mtfKI=, #=qdsgcwIUiW8iaC14wEQzoBQcVV$EpHIcuQDBIQKr$XpE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R8tBTTp9MNEkBhpEKnhs4=(Stream #=zm5mtfKI=, String #=zm9UlLKg=, Object[] #=zuzQDn9A=, Type[] #=zW$XvSLo=, Type[] #=zt2j7NR0=, Object[] #=zM7A9fpQ=) at dje_qW2GC9FBJW8QE2E3JQMWNWH5VVKE6YQQ76G9Q3SMK77WRF8CDGXLA_ejd.#=zyz5ItHUCloUlKIa1YBSLrkg=(Stream #=zm5mtfKI=, String #=zm9UlLKg=, Object[] #=zuzQDn9A=) at dje_qW2GC9FBJW8QE2E3JQMWNWH5VVKE6YQQ76G9Q3SMK77WRF8CDGXLA_ejd.#=zBziQUVmciVb3MFz29ho$YNGZj605(Stream #=zm5mtfKI=, String #=zm9UlLKg=, Object[] #=zuzQDn9A=) at #=ztXDBf4a8pGssZ0JqIgvGWjz3OFwwaHVfFeEkAvlR1IB1fj$vgAJ_yI8=.LoadRawData(Rectangle #=zE$G$ZOU=, RawDataSettings #=zy5gR7Cd7wsfI, IPartialRawDataLoader #=zRp5zHsArqz4a) at #=ztXDBf4a8pGssZ0JqIgvGWjz3OFwwaHVfFeEkAvlR1IB1fj$vgAJ_yI8=.LoadPartialArgb32Pixels(Rectangle #=zE$G$ZOU=, IPartialArgb32PixelLoader #=zCHgGvlCZoU4g) at #=zcmj_TojitiM_c7GQ4luu2mRkaTgwmyaT0w==.#=zkMRjB3w=(Rectangle #=zGRKUnWaE_9qX) at #=zFe3gBInLlNJgaE2bO4Bx4JnOw$K$.#=zVm58KeMivpgI(#=zs3JvkPqb0V4LOP3QDDuBGHff1JexnPihsg== #=z$ehwSS$3XYPy, IList1 #=zT6cCSR7SrLOF, #=zeQdFPmiKnhF4oTfGTjihJfYUQRZJIXAkRGu6DOs= #=zv0$QmlyH3ctE) at #=zFe3gBInLlNJgaE2bO4Bx4JnOw$K$.#=zkMRjB3w=(Rectangle #=zGRKUnWaE_9qX, #=zs3JvkPqb0V4LOP3QDDuBGHff1JexnPihsg== #=z$ehwSS$3XYPy, ProcessingType #=zqPG5EZo=, Int32 #=z6qbVYdz7rsbz, Int32 #=zdUjN3YEHSCBF, #=zeQdFPmiKnhF4oTfGTjihJfYUQRZJIXAkRGu6DOs= #=zv0$QmlyH3ctE) at #=zFe3gBInLlNJgaE2bO4Bx4JnOw$K$.#=zkMRjB3w=(Rectangle #=zGRKUnWaE_9qX, #=zs3JvkPqb0V4LOP3QDDuBGHff1JexnPihsg== #=z$ehwSS$3XYPy, #=zeQdFPmiKnhF4oTfGTjihJfYUQRZJIXAkRGu6DOs= #=zv0$QmlyH3ctE) at #=zqSx8UNngJ7WmAFT3CG06S14u1VoU5aC0QeZYZ2MFrVxi.#=zFVofnvFv0c4GH$Pe2$QyPns=(Rectangle #=zE$G$ZOU=, IPartialArgb32PixelLoader #=zdVyz4eGhx3y6) at Aspose.Imaging.RasterImage.#=z75nfn6fzxilo(Rectangle #=zE$G$ZOU=, IPartialArgb32PixelLoader #=zUNJnFqIprbIH, Boolean #=znoiq7XujQlnGZW_iug==) at Aspose.Imaging.RasterImage.#=zFVofnvFv0c4GH$Pe2$QyPns=(Rectangle #=zE$G$ZOU=, IPartialArgb32PixelLoader #=zdVyz4eGhx3y6, Boolean #=znoiq7XujQlnGZW_iug==) at Aspose.Imaging.FileFormats.Jpeg.JpegImage.#=zpZHT3O4AzP$T(RasterImage #=zyZPqKO8=, JpegOptions #=zTZpv5r4=, #=zHDOQXQyuYJSrkiofonnPZ7CAQYZBAARU0kg9AK5_1TJ2 #=zekF2XZ9H5msd, Rectangle #=zF_xj1Qo9$FVf) at Aspose.Imaging.FileFormats.Jpeg.JpegImage.#=zVxAX2ulJHNa$(RasterImage #=zdkCghtjeV0K7, Stream #=zkxM7iWw=, JFIFData #=zhnyvg6VccGGC, Byte[] #=zsGFh19bKHn8R7Ekn6A==, JpegOptions #=zTZpv5r4=, Rectangle #=zeV0n9AR$luWi) at #=zSDIG0KClgH9cqGf7FM1sKGWGkLZw5pyoExYrJtQvXRWrkdVs0XHQkTU=.#=zMN4bxHA=(#=zV0BV2hY= #=zxx2OCnA=, RasterImage #=zXtZce6o2oOXexPCR6A==, Stream #=zkxM7iWw=, ImageOptionsBase #=zgc8_IiA=, Rectangle #=z$ZGg31Jy0TAu) at #=zDlvEXouwvgo5jdGebu6J4JrfPAeEucqXCJIQwv8y8WTtJrf43Bwfh4WHtXU4.#=zMN4bxHA=(#=zV0BV2hY= #=zxx2OCnA=, Image #=zyZPqKO8=, Stream #=zkxM7iWw=, ImageOptionsBase #=zgc8_IiA=, Rectangle #=z$ZGg31Jy0TAu, Rectangle #=zJMr5Hv0IlUMff$ocRQ==) at #=zb6UGjs9XLodm6_VJLLzxWw$dXhcBzYSl0qjv6vCaoKPtfQn2FQ==.Export(Image #=zyZPqKO8=, Stream #=zkxM7iWw=, ImageOptionsBase #=zgc8_IiA=, Rectangle #=zJMr5Hv0IlUMff$ocRQ==) at Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle) — End of inner exception stack trace — at Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle) at Aspose.Imaging.RasterImage.Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle) at Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase) at Aspose.Pdf.Image.#=zBqgRg2o=(Double& #=zyOjGOPk=, Double& #=zg0aXTwY=, Double& #=zYFI9K7Q=, Boolean #=zv2Qo4RvNVMs9, MarginInfo #=zT$aDIMY=, Double #=zcNI85eVbeQtQ, Double #=zj_Vxw3g=, Page #=zrV_1Fq8=, List1 #=z8KDDkJc=, Boolean #=zse49BKyADJQS, Boolean #=zTXYjaJoMG0i0, Boolean #=zfaNHi_s=, Paragraphs& #=zyZgyggXz$eML1rPqpA==, Double #=zq8FHH9n0OULSTvzkxA==, Double #=z95bjuac=, Int32 #=zfj6RbtgiuyX5zrsvBkBqExs=, Double #=zfW0Qqev2ZN72) at #=z4PG3huyiInzmFaPM_Sl53Lc=.#=zBqgRg2o=() at Aspose.Pdf.Page.#=zXNM8Gggpztgf(Page #=zrV_1Fq8=, List1 #=z8KDDkJc=, Double #=zuFzkces=, Double #=zj_Vxw3g=) at Aspose.Pdf.Page.#=zNy8Uo0o=(Page #=zrV_1Fq8=) at Aspose.Pdf.Page.#=zJexn91lgiYm2eG3FJg==() at Aspose.Pdf.Document.ProcessParagraphs() at Aspose.Pdf.Document.#=zRDUUHiERYQ0V(Stream #=zbMelC3c=, SaveOptions #=zcg95f769zBEM) at Aspose.Pdf.Document.#=zaaVK7sxnBkC3(Stream #=zbMelC3c=, SaveOptions #=zcg95f769zBEM) at Aspose.Pdf.Document.Save(Stream output) at AssureCare.Document.Processor.Toolkit.Services.Concrete.AsposeDocumentProcessingServiceProvider.Convert2Pdf(Stream inputStream, String fileExt) in C:\repos\DocumentProcessorToolkit\AssureCare.Document.Processor.Toolkit\Services\Concrete\AsposeDocumentProcessingServiceProvider.cs:line 173 — End of inner exception stack trace — at AssureCare.Document.Processor.Toolkit.Services.Concrete.AsposeDocumentProcessingServiceProvider.Convert2Pdf(Stream inputStream, String fileExt) in C:\repos\DocumentProcessorToolkit\AssureCare.Document.Processor.Toolkit\Services\Concrete\AsposeDocumentProcessingServiceProvider.cs:line 184 at document_handling_service.Services.DocumentService.ProcessAndStoreDocumentAsync(DocumentRequestModel documentRequestModel, Int32 chunkSize) in C:\repos\Services\DocumentHandlingService\document-handling-service\Services\DocumentService.cs:line 344

Code:
var pdf = new Aspose.Pdf.Document();
var image = new Image() { ImageStream = inputStream };
pdf.Pages.Add().Paragraphs.Add(image);
pdf.Save(outputStream);

Find the attached files to be convert
https://file.io/Ltrl0ILAVDKF

@cdayalal
The document you provided a link to cannot be loaded. The file sharing service displays the message “The transfer you requested has been deleted.” Please check if the link is valid.

Try this one

@cdayalal
What version of the library are you using, what OS?
In my environment (Windows 10, .Net 6, library version 24.10) the document was created without problems.

I have tested it in Local windows 11 with latest stable package it works fine but getting issue on test env which is linux based

@cdayalal
Tried it for .Net 8 project with Docker - I didn’t get any exception.
Which option (kind of .Net) do you use?

I am using .net 8 version

@cdayalal
For Linux, the current library to use is Aspose.Pdf.Drawing. Are you using that or Aspose.Pdf?

Yes I am using that Aspose.Pdf.Drawing

@cdayalal
I have posted a C# .Net 8 project with Docker - please check if it works for you.