Getting can not allocate so many bytes error while JPEG to PDF

I am trying to convert 40 mb jpeg to pdf…it working fine in my local which is windows but getting below error test env.

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

Error:
System.InvalidOperationException: Failed to convert document to PDF: Cannot allocate so many bytes. Use LoadPartialPixels instead. —> : Cannot allocate so many bytes. Use LoadPartialPixels instead. at e.( , Int32[] ,  ,  ) at .( , Byte[] ,  ,  ) at ..( ) at .( , IList1 ,  ) at .( ,  ,  , Int32 , Int32 ,  ) at .( ,  ,  ) at .(Byte[][] ) at .(Object , Int32 ) at .(Int32 ) at .( ,  , Int32 , Int32 , Int32 , Boolean ) at .(Int32 , Int32 , Int32 ,  ) at .( ) at .( , e ,  ) at .( ,  ) at .( ) at .( , IList1 ,  ) at .( ,  ,  , Int32 , Int32 ,  ) at .( ,  ,  ) at .( ,  ) at e.( ,  , Boolean ) at e.( , Boolean ) at e.( ) at .(Stream ,  ) at .(Stream ,  ) at System.Drawing.Bitmap…ctor(Stream stream, Boolean useIcm) at System.Drawing.Bitmap…ctor(Stream stream) 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) — End of inner exception stack trace — at AssureCare.Document.Processor.Toolkit.Services.Concrete.AsposeDocumentProcessingServiceProvider.Convert2Pdf(Stream inputStream, String fileExt) at document_handling_service.Services.DocumentService.ProcessAndStoreDocumentAsync(DocumentRequestModel documentRequestModel, Int32 chunkSize) in /src/document-handling-service/Services/DocumentService.cs:line 365

Env:
Test env: linux

Package:
Aspose.PDF.Drawing : 24.10.0
Aspose.Words: 24.10.0

File:

@cdayalal

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-55876

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.