Aspose pdf .NET Null reference exception

Hello,
I have a problem while using the Aspose.pdf for .NET.
Basic explanation: I am trying to create a PDF based on a constructed HTML code that is saved inside a string and return the PDF into a MemoryStream to pass it further in the code.
The following is the code in question:

Document doc = new Document();

doc.PageInfo.Width = PageSize.A4.Width;
doc.PageInfo.Height = PageSize.A4.Height;

doc.PageInfo.Margin.Top = 10;
doc.PageInfo.Margin.Bottom = 10;
doc.PageInfo.Margin.Left = 10;
doc.PageInfo.Margin.Right = 10;

Page page = doc.Pages.Add();

HtmlFragment htmlFragment = new HtmlFragment(finalStr);

page.Paragraphs.Add(htmlFragment);

fileStream = new MemoryStream();

doc.Save(fileStream);
fileStream.Seek(0, SeekOrigin.Begin);

Also, a bit earlier in the code I am setting a Aspose Total License too with the following code:

string licenseName = "Aspose.Total.NET.lic";

var license = new Aspose.Pdf.License();
license.SetLicense(licenseName);

The problem I’m facing is that when this line doc.Save(fileStream); is being executed, the code throws a Null reference exception and I tried researching what the problem might be but I’m out of ideeas. Can anyone help?

Edit: If needed, I can post an example of a constructed html as well.
Edit 2: finalStr contains the constructed HTML.

@CatalinRus

Yes, if you can please share the sample HTML in .zip format with us or in text format, we will test the scenario in our environment and address it accordingly.

HighestVsLowest_HTML.zip (150.0 KB)

I have attached an example of HTML that I’d like to build with Aspose. The zip includes the HTML file along with the CSS and some JS Scripts.
It also includes an example that was built with the Nugget package that I used before(nReco) and an example of what it looks like with a different type of code with Aspose. Do you have any ideea why the one built with Aspose looks so much different than the one that was built with nReco?

P.S: the code in the first post is what I’d like to use in my project. The code with which I generated the Aspose example in the zip is different but with the same margin values.

@CatalinRus

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-55825

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.