We’ve found that the following, very basic, HTML causes Aspose.HTML (v20.9) to hang whilst memory quickly leaks.
<html>
<head>
</head>
<body>
<img src="C:\temp\image001.png" height="1024">
</body>
</html>
Here is our conversion code that hangs on renderer.Render()…
public override ConversionResultStream Convert(Stream sourceStream, ConversionContext context)
{
var pdfOptions = new PdfRenderingOptions();
var width = Unit.FromMillimeters(210);
var height = Unit.FromMillimeters(297);
var a4Size = new Size(width, height);
var margin = new Margin(Unit.FromMillimeters(20));
pdfOptions.PageSetup.AnyPage = new Page(a4Size, margin);
using (var sourcePdfStream = this.GetStream("HtmlConvert"))
{
using (var pdfDevice = new PdfDevice(pdfOptions, sourcePdfStream))
{
using (var renderer = new HtmlRenderer())
{
using (var htmlDocument = new HTMLDocument(sourceStream, ""))
{
renderer.Render(pdfDevice, htmlDocument, Config.HtmlConversionTimeout);
}
}
pdfDevice.Dispose();
}
var result = new ConversionResultStream(GetStream());
result.ResultMetadata = ConvertPdfToArchiveFormat(sourcePdfStream, result.Result, result.ConversionLog);
return result;
}
}
We can remove the height attribute and it works as expected.
Also note: the timeout passed into the renderer.Render() method doesn’t appear to be honoured either.
Can someone confirm the same results?