CPU consupntion when converting HTML to PDF

Hi Team,

We are having a bit of trouble… when converting HTML to PDF, the CPU consumption is through the roof.

Let me explain a bit better: We have a Soap WS in Framework 4.8 running in IIS. That receives “a lot” of requests every day. And more than once a day we must restart the application pool because it is using all of the CPU.

We are using Aspose version 24.10

Looking at the Task manager it seems that the w3w process is “stuck”

Code:

SaveDocumentToOutput(Aspose.Pdf.Document document, ref HtmlToPDFOutput output)

{

using (var outStream = new MemoryStream())

{

document.Save(outStream, Aspose.Pdf.SaveFormat.Pdf);

output.PDF = outStream.Length > 0 ? outStream.ToArray() : Array.Empty();

}

}

Is there any thing I can do to minimize the CPU consumption?

A bit more informations.
after calling the WS 1000 times we got 2 calls stuck, this two are using aprox 50% of the CPU
image.png (16.6 KB)

image.png (10.7 KB)

@FredericoS

Have you confirmed that the issue is occurring for any kind of HTML document and not only with specific input HTML? Furthermore, have you tried saving the results to file path instead of memory stream? Please share some sample file(s) for our reference and steps to reproduce the issue so that we can address it accordingly.