I believe our production application where we merge 1500 pdf pages, throws this exception when it crosses 1.2GB of memory usage, so in order to replicate this you just need to increase the number of files to merge(may be >5k) and call the “OptimizeDocument” function later.
Also, we have observed a sudden spike in memory from 300MB to 1.2GB when this function is called.
Update: We are getting another exception some of the times (refer below screenshot). Screenshot (218).png (220.4 KB)
Please review and provide us a solution as soon as you can.
Could you please attach the following resources here for testing:
Your input PDF.
Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.
As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.
PS: To attach these resources, please zip and upload them.
Since we were getting “Out of memory exception” from Aspose library (version 17.8.0.0), we have upgraded the library to the latest version (#region Assembly Aspose.PDF, Version=22.4.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56) and we still get the same “Out of memory exception” exception.
Details:
As per our analysis, the exception occurs when there are more than 15 pages for pdf conversion. Also, it comes from below method call
Aspose.Pdf.Document.Save(string outputFileName) from Aspose.Pdf namespace.
Exception:
System.OutOfMemoryException: Exception of type ‘System.OutOfMemoryException’ was thrown.
Please review and provide your feedback as soon as possible.
@sergei.shibanov, We create pdf file using Aspose library, from the scanned file (TIFF format) and the scanned TIFF file into pdf conversion is failing and prompted with above mentioned Out of memory exception. Hence we are not able to generate the pdf file. Can we get into a call to sort out this issue immediately?
@tjeganathan
Neither the topic title nor the code above is intended to convert tiff to pdf. Judging by them, work is being done with a pdf document, which is why we asked for a pdf document.
For issue about create a pdf file using a library from a scanned file (TIFF format), it is better to create a separate branch in which to bring the code fragment used and attach the tiff file. You can zip it into a zip archive - embed such files is possible. Another option (especially if you can’t attach it because of the size) is to upload the file to the cloud and give a link.