Problem converting big documents (over 30Mb) causes OutOfMemoryException

Hello,

we are using Aspose.Pdf 16.12.0 for generating PDF document from HTML. We faced with problem that converting big documents (over 30Mb) causes OutOfMemoryException. Here code snippet:

public void GeneratePdf(Stream inputHtml, Stream outputPdf)
{
    var htmlLoadOptions = new Aspose.Pdf.HtmlLoadOptions();
    
    using (var pdfDocument = new Aspose.Pdf.Document(inputHtml, htmlLoadOptions))
    {
        pdfDocument.Save(outputPdf, Aspose.Pdf.SaveFormat.Pdf);
    }
}

Result StackTrace:

в Aspose.CSS.Grammar.CSStLexer.Emit()

в Aspose.CSS.Grammar.CSStLexer.nextTokenRecover()

в Aspose.CSS.Grammar.CSStLexer.NextToken()

в Antlr.Runtime.CommonTokenStream.FillBuffer()

в Antlr.Runtime.CommonTokenStream.LT(Int32 k)

в Aspose.CSS.Grammar.CSStParser.inlinestyle()

в Aspose.CSS.Grammar.CSStParser.ParseInline()

в Aspose.CSS.Parser.CSSParser.ParseInlineStyle(String source)

в Aspose.CSS.Engine.CSSEngine.ParseInlineStyle(String content, INode ownerNode)

в Aspose.CSS.Engine.AbstractCSSStyleDeclaration.ParseInlineStyle(String content)

в Aspose.CSS.Engine.AbstractCSSStyleDeclaration.SetProperty(String propertyName, String value, String priority)

в Aspose.CSS.Engine.StyleAttributesDeclarationsBuilder.SetTableCellValues(IElement element, CommonCSSStyleDeclaration declaration)

в Aspose.CSS.Engine.StyleAttributesDeclarationsBuilder.Create(IElement element)

в Aspose.CSS.Engine.CSSEngine.GetCascadedStyleMap(IElement element, String pseudoElement)

в Aspose.CSS.Engine.CSSEngine.ApplyStyles(IElement element)

в Aspose.CSS.Engine.CSSEngine.ApplyStyles(IElement element)

в Aspose.CSS.Engine.CSSEngine.ApplyStyles(IElement element)

в Aspose.CSS.Engine.CSSEngine.ApplyStyles(IElement element)

в Aspose.CSS.Engine.CSSEngine.ApplyStyles(IElement element)

в Aspose.CSS.Engine.CSSEngine.ApplyStyles(IElement element)

в Aspose.CSS.Engine.CSSEngine.ApplyStyles(ICSSStylableDocument document)

в Aspose.HTML.DOM.BrowsingContext.Open(ILSInput input)

в Aspose.HTML.DOM.BrowsingContext.Open(Stream data)

в Aspose.HTML.Browser.Window.Navigate(Stream stream, NavigationData data)

в Aspose.HTML.Rendering.Aps.ApsConverter.Convert(Stream stream, ConverterOptions options)

в .[1](Stream [1], Document

, UriResolver , HtmlLoadOptions )

в Aspose.Pdf.Document.[1](Stream [1], LoadOptions

)

в Aspose.Pdf.Document..ctor(Stream input, LoadOptions options)

We tried to increase memory, test Net 4.0 and Net 4.5.1. but causes OutOfMemoryException too.

What could be the reason? What the size limit of HTML? Is there a workaround, for example, using another object Aspose?

Hi Sergey,


Thanks for your inquriy. We will appreciate it if you please share your sample HTML file, you may share your sample file via some file sharing service, e.g Dropbox, Google drive etc. It will help us to investigate your issue exactly and address it accordingly.

We are sorry for the inconvenience.

Best Regards,

faced with similar problem, see PDF to html OutOfMemoryException


hope you will have some solution soon :slight_smile:

Here test HTML file Dropbox - test.html - Simplify your life

Same issue. I have attached a document. I need this fixed ASAP as I had to convert our export process to use another processor (wkhtml2PDF) and this is NOT what I want to use.


I am using the latest (17.1) release. This document for some reason takes 2GB of memory when processing then it gives the exception.

Hi there,


Thanks for sharing source documents. I am testing the scenario with shared documents and will update you soon with my findings.

Best Regards,
Hi Sergey,

directum:
Here test HTML file https://www.dropbox.com/s/5fv5z2ems6m0hko/test.html?dl=0

Thanks for sharing your source document. I have tested the scenario and noticed that Aspose.Pdf consumes whole memory of system, so logged a ticket PDFNET-42217 in our issue tracking system for further investigation and rectification. We will keep you updated about the issue resolution progress.

We are sorry for the inconvenience.

Best Regards,