Hello,
we are trying to merge pdf’s by using the rest api PutMergeDocuments method but sometimes (normally when resultant pdf total size is higher than 10MB) we obtain a OutOfMemoryException. I dont think the file is important because we have been using diferent files and the same errors are obtained.
Here you have the stack trace of error#1:
Error: PutMergeDocuments. Parameters: name ‘pdfsResultado.pdf’, mergeDocuments ‘{“List”:[“f75fd91e-e7d1-4196-9db1-afb46606aa36\a.pdf”,“f75fd91e-e7d1-4196-9db1-afb46606aa36\b.pdf”]}’, storage ‘asposepdfpro’, folder ‘f75fd91e-e7d1-4196-9db1-afb46606aa36’. Error result: System.OutOfMemoryException: Out of memory. at System.Drawing.Bitmap…ctor(Stream stream) at Aspose.Pdf.XImage.#=zJMXNCYX_fFnn(Stream #=zQnlNbJo=, Document #=zHj5X048=) at Aspose.Pdf.XImage.#=zJMXNCYX_fFnn() at Aspose.Pdf.XImage.get_Grayscaled() at Aspose.Pdf.Cloud.Business.ImagePresentation…ctor(XImage image, PresentationUriBuilder uriBuilder, ImageCollection imageCollection, Rectangle _rectangle, Int32 pageNumber) in C:\ms\src\Aspose.PDF.Cloud\Business\Images\ImagePresentation.cs:line 26 at Aspose.Pdf.Cloud.Business.ImageCollection…ctor(PresentationUriBuilder uriBuilder, ImagePlacementCollection imagePlacements, Int32 pageNumber) in C:\ms\src\Aspose.PDF.Cloud\Business\Images\ImageCollection.cs:line 24 at Aspose.Pdf.Cloud.Business.PdfPagePresentation.get_Images() in C:\ms\src\Aspose.PDF.Cloud\Business\PdfPagePresentation.cs:line 186 at Aspose.Pdf.Cloud.Business.PresentationExtension.ToDTO(PageCollection pages) in C:\ms\src\Aspose.PDF.Cloud\Business\PresentationExtension.cs:line 53 at Aspose.Pdf.Cloud.Business.PresentationExtension.ToDTO(IPdfDocumentPresentation presentation) in C:\ms\src\Aspose.PDF.Cloud\Business\PresentationExtension.cs:line 35 at Aspose.Pdf.Cloud.Business.ResponseExtension.ToResponse(IPdfDocumentPresentation presentation) in C:\ms\src\Aspose.PDF.Cloud\Business\ResponseExtension.cs:line 23 at Aspose.Pdf.Cloud.Controllers.MergeController.PutMergeDocuments(String name, String appSid, MergeDocuments mergeDocuments, String storage, String folder) in C:\ms\src\Aspose.PDF.Cloud\Controllers\MergeController.cs:line 82.
and error#2:
Error: PutMergeDocuments. Parameters: name ‘pdfsResultado.pdf’, mergeDocuments ‘{“List”:[“d9a664aa-a099-4423-b074-e95e13464ec1\pdfsResultado - Copy.pdf”,“d9a664aa-a099-4423-b074-e95e13464ec1\pdfsResultado.pdf”]}’, storage ‘asposepdfpro’, folder ‘d9a664aa-a099-4423-b074-e95e13464ec1’. Error result: System.InvalidOperationException: Could not merge documents. See inner exceptions for details. —> System.OutOfMemoryException: Exception of type ‘System.OutOfMemoryException’ was thrown. at System.IO.MemoryStream.set_Capacity(Int32 value) at System.IO.MemoryStream.EnsureCapacity(Int32 value) at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count) at #=z2ufRI23shEN4KyuIjhj23ILyzyffVt86hQsxYLY=.#=zJglEBy0=(Byte[] #=zZGQm7EQ=, Int32 #=zXR2q0no=, Int32 #=zDy$dubY=) at #=zbcJOOSRlgSRCXIVJN$Uh_0flgYUEAswYPQ==.#=ztoBLvsc=.#=zn1YpQYM=(#=z$dxKBEAN91QnqlPIWVaHqnFGCkQdTIpyard9$YUL8MYp #=zqNKZOQeAGlqz, #=z9mDHqVYfX$_GEpIbXgNiuvra7DP073WgVg== #=zJ8hr0B3ISa2E, Boolean #=zBYCHPLPtB1tF, Int64& #=zXR2q0no=) at #=zbcJOOSRlgSRCXIVJN$Uh_0flgYUEAswYPQ==.#=ztoBLvsc=.#=zn1YpQYM=(#=z$dxKBEAN91QnqlPIWVaHqnFGCkQdTIpyard9$YUL8MYp #=zqNKZOQeAGlqz, #=z9mDHqVYfX$_GEpIbXgNiuvra7DP073WgVg== #=zJ8hr0B3ISa2E) at #=zc_Iw$jN6VZ3CeoK8_qFF2OBl8Sz18_5l6INg2BQ=.#=zn1YpQYM=(#=z$dxKBEA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Glqz, #=z9mDHqVYfX$_GEpIbXgNiuvra7DP073WgVg== #=zJ8hr0B3ISa2E, Int64& #=zXR2q0no=) at #=zXX9R9yGWV0GsOE7Kaa11IIhBSRBBDMt5fkOMqGTaTFPfYFjrqOxvu5E=.#=zxWuOC2U=(#=z$dxKBEAN91QnqlPIWVaHqnFGCkQdTIpyard9$YUL8MYp #=zqNKZOQeAGlqz, #=zM9aRlL6WFPKtGYQrz_64YvhR425lF3p_E6yQBA0= #=znBYtyWE=) at (Object , Object[] ) at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=z4nKmKQrNAbz49Fm6u6Wx9psivcoAT8_1KaFY7wQ=(MethodBase #=zfTzq_eo=, Object #=zrJcNi5M=, Object[] #=zYSRNyLE=, Boolean #=zOumeXqU=) at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=zfTkmkI11VcaffwEV7wQmM2MDp8lOSQS$Re53S0N9PEIN(MethodBase #=zfTzq_eo=, Boolean #=zrJcNi5M=) at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=zRQkoH8U425weVu5rdAPBKS0=(#=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0= #=zfTzq_eo=, #=q3JvupNWAWIt1hQXkpqrRFdRhJk4c5mhn_1zRI8y2cKU= #=zrJcNi5M=) at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=z6p5H0bqLYIenHr2bSmA5siWa05FouZai0ydt6dQ=() at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=zfMJu4Bql9NzLmGiVvyNfdj4Ba_U8N7v1JGI2IUE=(Boolean #=zfTzq_eo=) at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=zA5SxWD_pK_XqWE6zyw5ZFHQryncRJQ9shRr5Z1xxHxQ4(Object #=zfTzq_eo=) at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=zBhnA4ZSQ4DEkoBxZ79xTHMbbmJB4_ubTSA==() at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=zfoq0Owq94AOhkhtlCogbxkr4ebjHtjPKVV1VA1M=(Object #=zfTzq_eo=, UInt32 #=zrJcNi5M=) at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=zfMJu4Bql9NzLmGiVvyNfdj4Ba_U8N7v1JGI2IUE=(Boolean #=zfTzq_eo=) at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=zvVW5eJQgDuvZQnR5I3Li7$$pTublBvQObnok_Xo=() at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=z1t9JIq1UYn29co3hzywaKpI=(Object[] #=zfTzq_eo=, Type[] #=zrJcNi5M=, Type[] #=zYSRNyLE=, Object[] #=zOumeXqU=) at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=zyISS6VwNO05TV5QI1c_kdUEhZhAGEgPnftmQ8wc=(Stream #=zfTzq_eo=, String #=zrJcNi5M=, Object[] #=zYSRNyLE=, Type[] #=zOumeXqU=, Type[] #=zO0crUDw=, Object[] #=zJrFPpfU=) at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=z5j18LNHUhmH22P2IKTuPbiWPWVxKF21Kp0TMUw4=(Stream #=zfTzq_eo=, String #=zrJcNi5M=, Object[] #=zYSRNyLE=) at #=qVNVRJVzHhGDD2q4TVWbHKipS1r2Snc1magmrG2lXjy0=.#=zaQg$ZgBKjg6vIuYFhfrsku0tarjpPQ6fSA==(Stream #=zfTzq_eo=, String #=zrJcNi5M=, Object[] #=zYSRNyLE=) at #=zRAhI0pPiSmM4tNL5gFnCTga4hn9ZX$7b2Q==.#=zxWuOC2U=() at #=zolizZEOJAndYakPP6O4z9_bOo6RayHcpJg==.#=zxWuOC2U=(Stream #=zn$yR1t8=) at #=z9TwjKQdR7_Z7v7UV_kAbTVZNkpLv.#=zxWuOC2U=(Stream #=zn$yR1t8=) at Aspose.Pdf.Document.#=zgRidtaqOJiCj(Stream #=zXh7sqME=, SaveOptions #=z$EqHIv7hQ3h1) at Aspose.Pdf.Document.Save(Stream output) at Aspose.Pdf.Facades.PdfFileEditor.Concatenate(Stream[] inputStream, Stream outputStream) — End of inner exception stack trace — at Aspose.Pdf.Cloud.Business.DocumentCreation.DocumentCreationManagerLegacy.Merge(IFileManagerWrapper fileManager, String requestRoot, IList1 files, String outputFile) in C:\ms\src\Aspose.PDF.Cloud\Business\DocumentCreation\DocumentCreationManagerLegacy.cs:line 138 at Aspose.Pdf.Cloud.Business.PdfDocumentManager.Merge(IFileManagerWrapper fileManager, String requestRoot, IList
1 files, String outputFile) in C:\ms\src\Aspose.PDF.Cloud\Business\PdfDocumentManager.cs:line 384 at Aspose.Pdf.Cloud.Controllers.MergeController.PutMergeDocuments(String name, String appSid, MergeDocuments mergeDocuments, String storage, String folder) in C:\ms\src\Aspose.PDF.Cloud\Controllers\MergeController.cs:line 80.
Thanks in advance.
Best regards