OutOfMemoryException with Constructor Aspose.Pdf.Document

I get an OutOfMemoryException with new Aspose.Pdf.Document(workStream, objLoadOption) (On Premise API) where workStream is a byte[] for an Html string of length < 20M

Exception looks to be 250 calls deep.
Commences at:
at Aspose.Pdf.Document.#=zpVN_2Rc=(Stream #=zet709qk=, LoadOptions #=zmSsktBU=)
at Aspose.Pdf.Document…ctor(Stream input, LoadOptions options)

Q1 Does the HTML have to meet specific requirements to guarentee that an OoME will not be generated. If so what are they?

Q2 Is there a way of coding, to limit the memory that this constructor wants to allocate such that the OoME never arises. I’d rather have a Exception indicating trying to allocate too much memory.

OcME is a production environment is pretty serious, any assiatance would be greatfully received

@JJBlip

There are no such specifications for the HTML. However, please share your sample HTML file in .zip format with us along with the code snippet that you are using to add it. We will test the scenario in our environment and address it accordingly.

We are afraid that you cannot specify or limit the memory usage by the Document. The memory consumption depends upon the structure, complexity, and size of the content with which Document is initialized. We will surely investigate the reason behind this error that you are facing and share our feedback with you.