We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

System.OutofMemory exception in version 12.9

Hi all,
summary of the issue : I’m using Aspose.PDF for .net in (.NET 4.5.x version)
in my asp.net web api 2 application to generate PDF document.
In our code there is a segment where we dynamically fill up an HTML page and convert this html content into pdf and we do it for multiple pages. Now the issue is earlier in aspose.pdf version the generation was seamless and without any issues. After i upgraded my version and finally to .In both these versions , the 3rd line of the code segment is giving me error of System,OutofMemory exception. This throws error when more than 4 /5 pages are dynamically created in this manner. Whereas earlier it used to seamlessly work with more than 12 pages.
code segment :
using (Aspose.PDF.Document docXML = new Document(“ComplexTextIndexingPage2Template.pdf”))

Aspose.Pdf.Document doc = new Document(ComplexTextTemplateBlank);
//pdfDocument is a separate pdf document in aspose.pdf where
// the
pdfDocument.Pages.Insert(pageNo, doc.Pages);

The details of the error along with exception message and screenshot is attached.
Aspose.docx (167.1 KB)
also the artefacts like the html used for conversion into pdf is attached .asose pdf arefacts issues.zip (18.2 KB)

Please have a look into the issue and check why it is appearing in the 12.8 and 12.9 version while it was properly working in 11.7 version.

Please let me know if any more further details are needed.
also the code screenshot is attached .aspose code snippet.png (43.7 KB)

The error is generated in the 3rd last line of the code in screenshot and also you can see in the word document.
Please see the last page of the document to see the exception message generated


We tested the scenario in our environment using Aspose.PDF for .NET 21.9 and did not notice any issue. We used the below code snippet in order to generate a PDF from your XML:

Document doc = new Document();
doc.BindXml(dataDir + "ComplexIndexingPage1Temp7ef81544-1287-4b84-9e39-e5159b1ddd47.xml");
doc.Save(dataDir + "output.pdf");

output.pdf (111.1 KB)

Could you please try to use the above code snippet and make sure that your VS Project is targeting to x64 mode of debugging? In case you still face any issues, please share a sample console application with us which is able to reproduce the similar exception. We will again test the scenario in our environment and address it accordingly.

hi Asad,
I had provided a small snippet and just one particular html segment which was creating error. I would suggest load a big pdf with at least 15 pages in document(aspose.pdf.document) object and then create a loop to convert the html to pdf I have provided at least 7 times and keep adding the pages in document object.
we cannot provided our exact code base as it is against our corporate policy.
Please help us. The older version was not giving System.OutOfMemory exception only the newer version.
Please help

Please take this on high Priority! We are using for a big German Company Aspose PDF.NET and we have in this case a high outage risk including high revenue risk.

Thx, Stefan - Director Cognizant

@dticog, @kishalaya

We do understand the significance of the issue for you. We have been trying to replicate it in our environment using 21.9 version of the API. However, we were unable to notice any issue. Please note that it is necessary to reproduce the similar issue at our end in order to address it accordingly.

Please check the below code snippet which we used to test the case again:

Document doc = new Document();
for (int i = 0; i < 15; i++)
 doc.Pages.Add().Paragraphs.Add(new TextFragment("Page " + (i + 1)));
for (int j = 0; j < 10; j++)
 Document newDoc = new Document();
 newDoc.BindXml(dataDir + "ComplexIndexingPage1Temp7ef81544-1287-4b84-9e39-e5159b1ddd47.xml");
 doc.Save(dataDir + "output.pdf");

output.pdf (1.1 MB)

Please note that we are not asking for your complete code base but a sample console application with minimal code to reproduce the error. The code snippet that you have shared already involves three different document objects and the context of one object is unknown. Also, you are initializing docXML object with a PDF that has no pages (we have checked it in the shared .zip Archive).

Please try to share a sample console application or modify the code snippet through which we tested above and share it with us so that it can replicate the similar issue that you are facing. As soon as we are able to reproduce the issue in our environment, we will address it accordingly.