Can't convert large html file to pdf(about 5M)

I have a large html file, want to convert to pdf. But it stopped for a long time.


code:
public virtual Stream Convert(Stream inputStream)
{
var outputStream = new MemoryStream();
var options = GetOptions();
using (var middleStream = new MemoryStream())
{
try
{
inputStream.Seek(0, SeekOrigin.Begin);
inputStream.CopyTo(middleStream);
middleStream.Seek(0, SeekOrigin.Begin);
var pdf = new Document(middleStream, options);
pdf.Save(outputStream, SaveFormat.Pdf);
outputStream.Seek(0, SeekOrigin.Begin);
middleStream.Close();
}
catch (Exception e)
{
throw new Exception(String.Format(“An error occurred when convert to pdf. Exception :{0}”, e));
}
}
return outputStream;
}



public override LoadOptions GetOptions()
{
var htmlLoadOptions = new HtmlLoadOptions();
htmlLoadOptions.PageInfo.Margin.Bottom = 10;
htmlLoadOptions.PageInfo.Margin.Top = 20;
return htmlLoadOptions;
}




it stopped at var pdf = new Document(middleStream, options);

And it occupied a large number of my computer memory




Hi Louis,


Thanks for your inquiry. I have tested the HTML to PDF conversion with shared HTML document and noticed the reported issue. So logged a ticket PDFNEWNET-40534 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience caused.

Best Regards,