Convert XML to PDF using Aspose.PDF for .NET - process gets hung up in case of nested tags

Dear Team,

We are currently evaluating Aspose.net for PDF generation. We have a XML and have used your example code to generate a PDF. We see that for some XMLs which have a deep nesting the Save call becomes unresponsive with high CPU and constant memory usage. The XML s that have deep nesting have large Text fragments with the character count around 2000. If we use lesser characters the generation works but fails when the count is more than 1000 characters.

We have removed the nested tags in the XML to check the performance and it works with 2000 characters. So it appears that deep nesting of the DOM having large text might be the problem.

Do you have a recommendation of how to deal with these scenarios ?

We are using the latest version and are on .net 4.8 runtime. Let us know incase of other questions.

Tx

@vincent1

Would you kindly share your sample XML file along with the code snippet that you are using and it is causing the issue. We will test the scenario in our environment and address it accordingly.

Dear Asad,

Thanks you for your response.
I will share across a copy shortly.

Tx,

@vincent1

Sure, please take your time.

Dear Team,

Sorry for the slow response, the xml file is here

Let me know if this helps.
Tx

@vincent1

We were able to reproduce the issue while using Aspose.PDF for .NET 21.1 with the following code snippet:

using (FileStream fs = new FileStream(dataDir + "output211.pdf", FileMode.CreateNew, FileAccess.ReadWrite))
{
 Document doc = new Document();
 doc.BindXml(dataDir + "XML-Template-aspose-masked-1.xml");
 doc.Save(fs);
}

Therefore, we have logged an issue as PDFNET-49336 in our issue tracking system for the sake of further investigation. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi Team,

Thanks for such a quick response.
Please take your time.

Tx

1 Like

Dear Team,

We have isolated this to a complicated DOM structure , we have improved our XML Structure and the pdf generation worked. Some details to add so that you can resolve this problem.

Attached is a XML with a simple structure which helps to recreate this issue. I think its some how related to page length calculation. The inner cells have multiple tables which have a long content in their cells.

Also note , we have noticed a memory leak of 7-9 MB for each PDF generation. Is there a solution for this ?

Tx

@vincent1

Thanks for sharing more details.

We have updated the ticket information accordingly and will investigate it from this perspective as well. Furthermore, we have also recorded your concerns related to memory leak and will take care of them during investigation of the ticket. We will let you know as soon as we have some updates regarding ticket resolution. Please give us some time.

We apologize for the inconvenience.