Posted on 03/07/2023 13:19:42
Dear Dynamicweb,
We are experiencing issues with multiple IronCefSubprocess in the Task Explorer - please see this screen dump: https://app.screencast.com/wv3uNCFrtXznH, which is taken up CPU.
We believe that it is caused due to a missing "using" in the section of code in IronPdfRenderProvider:
public override byte[] RenderFromContent(PdfContent content, PdfRendererSettings settings)
{
IronPdfLicense.InstallLicense();
var options = GetPdfPrintOptions(settings);
options.MarginTop += content.HeaderHeight;
options.MarginBottom += content.FooterHeight;
var renderer = new ChromePdfRenderer
{
RenderingOptions = options
};
var doc = renderer.RenderHtmlAsPdf(content.ContentHtml);
if (!string.IsNullOrEmpty(content.HeaderHtml))
{
var header = new HtmlHeaderFooter()
{
MaxHeight = content.HeaderHeight,
HtmlFragment = content.HeaderHtml
};
doc.AddHtmlHeaders(header, 0, 0, 0);
}
if (!string.IsNullOrEmpty(content.FooterHtml))
{
var footer = new HtmlHeaderFooter()
{
MaxHeight = content.FooterHeight,
HtmlFragment = content.FooterHtml
};
doc.AddHtmlFooters(footer, 0, 0, 0);
}
renderer.RenderingOptions = GetPdfPrintOptions(settings);
if (!string.IsNullOrEmpty(content.FirstPageHtml))
{
var first = renderer.RenderHtmlAsPdf(content.FirstPageHtml);
doc.PrependPdf(first);
}
if (!string.IsNullOrEmpty(content.LastPageHtml))
{
var last = renderer.RenderHtmlAsPdf(content.LastPageHtml);
doc.AppendPdf(last);
}
var data = doc.BinaryData;
return data;
}
This part must be include in a using-statement to have the resources disposed:
var doc = renderer.RenderHtmlAsPdf(content.ContentHtml);
I hope it can be added in a hotfix to 9.15.x
Best regards, Anders