Hi,
We are running in to a System.OutOfMemoryException when attempting to create a PDF file from HTML.
Our code has been working fine for months, however this particular conversion is causing us issues. Oddly enough, this particular conversion is working in our production environment, but not when debugging. Further, the issue is not limited to one developer since other developers were able to reproduce the issue.
Here is the code:
{
Pdf pdf = new Pdf {HtmlInfo = {ImgUrl = anImageUrl}};
Section section = pdf.Sections.Add();
section.IsLandscape = isLandscape;
Text text = new Text(section, anHtml);
text.IsHtmlTagSupported = true;
// Add page margins
Aspose.Pdf.Generator.MarginInfo marginInfo =
new Aspose.Pdf.Generator.MarginInfo
{
Top = PDF_MARGIN_TOP,
Bottom = PDF_MARGIN_BOTTOM,
Left = PDF_MARGIN_LEFT,
Right = PDF_MARGIN_RIGHT
};
section.PageInfo.Margin = marginInfo;
section.Paragraphs.Add(text);
Document document = new Document(pdf); //Out of Memory exception on this line
...
...
}
In case you need the HTML for testing purposes, I have attached a scrubbed version of it as a text file.
We are running in to a System.OutOfMemoryException when attempting to create a PDF file from HTML.
Our code has been working fine for months, however this particular conversion is causing us issues. Oddly enough, this particular conversion is working in our production environment, but not when debugging. Further, the issue is not limited to one developer since other developers were able to reproduce the issue.
Here is the code:
{
Pdf pdf = new Pdf {HtmlInfo = {ImgUrl = anImageUrl}};
Section section = pdf.Sections.Add();
section.IsLandscape = isLandscape;
Text text = new Text(section, anHtml);
text.IsHtmlTagSupported = true;
// Add page margins
Aspose.Pdf.Generator.MarginInfo marginInfo =
new Aspose.Pdf.Generator.MarginInfo
{
Top = PDF_MARGIN_TOP,
Bottom = PDF_MARGIN_BOTTOM,
Left = PDF_MARGIN_LEFT,
Right = PDF_MARGIN_RIGHT
};
section.PageInfo.Margin = marginInfo;
section.Paragraphs.Add(text);
Document document = new Document(pdf); //Out of Memory exception on this line
...
...
}
In case you need the HTML for testing purposes, I have attached a scrubbed version of it as a text file.