HTML Superscript looks different in PDF (the baseline is lower and the font bigger)

Hello,
We are using ASPOSE PDF for .Net v.23.8.0 to generate PDF from HTML documents.

In the actual html we are using html superscript tag like <sup>1</sup>.

In the generated pdf document, the font size of the superscript is bigger, and the baseline is lower than in the html. We tried with setting the font size, line height for superscript tag but not working at all. Also, we tried using inline styles, but it didn’t work either.

Please check the attached screenshot for reference.
Thanks!

CDViewer_B3rgfh8r0W.png (15.0 KB)

@ATaglioni

Can you please share your sample HTML in .zip format for our reference along with the code snippet to convert it into PDF? We will test the scenario in our environment and address it accordingly.

I attached an example of HTML. I used https://products.aspose.app/html/en/conversion/html-to-pdf to convert HTML to PDF and I obtained the superscript with a different format than the html, the same thing I get with the code we used.

Example HTML with sup.zip (465 Bytes)

@ATaglioni

Can you please check below attached PDF which we generated using Aspose.PDF for .NET 24.5 and the below code:

string html = File.ReadAllText(dataDir + "Example HTML with sup.html");

var byteArray = Encoding.UTF8.GetBytes(html);
using var inStream = new MemoryStream(byteArray);

var options = new HtmlLoadOptions
{
    // set Print or Screen mode
    HtmlMediaType = HtmlMediaType.Print,
    IsEmbedFonts = true,
    IsRenderToSinglePage = true
};

using var document = new Document(inStream, options);

document.Save(dataDir + "Example HTML with sup.pdf");

Example HTML with sup.pdf (160.7 KB)

Please let us know if you notice any issue or results are not as per your expectations.

I generated the PDFs (two versions) with this code using Aspose.PDF for .NET 24.5

string html = File.ReadAllText($"{dirPath}Test sup Regular.html");

var byteArray = Encoding.UTF8.GetBytes(html);
using var inStream = new MemoryStream(byteArray);

var options = new HtmlLoadOptions
{
    // set Print or Screen mode
    HtmlMediaType = HtmlMediaType.Print,
    IsEmbedFonts = true,
    IsRenderToSinglePage = true,
    DisableFontLicenseVerifications = true
};

using var document = new Document(inStream, options);

document.Save($"{dirPath}Test sup Regular.pdf");

And I got:
Result 1:
Different sup 1.jpg (65.5 KB)
With this HTML 1:
Test sup Regular.zip (54.5 KB)
Resulting PDF 1:
Test sup Regular.pdf (48.1 KB)

Result 2:
Different sup 2.png (80.7 KB)
With this HTML 2:
Test sup Bold.zip (36.2 KB)
Resulting PDF 2:
Test sup Bold.pdf (33.3 KB)

The screenshots clearly show that the superscript baseline is lower in the PDF files than in the corresponding HTML file.
Thanks.

@ATaglioni

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-57249

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.

Could you tell me when you are going to solve the Ticket PDFNET-57249?

@ATaglioni

The ticket will be prioritized on a first come first serve basis as per the free support policies. The resolution time of the ticket depends upon the number of issues logged prior to it as well as it complex nature. As soon as we make some progress towards ticket resolution, we will let you know. Please spare us some time. We are sorry for the inconvenience.

Hello, do you have an estimated resolution time for the ticket (PDFNET-57249— Status : Open)? This is an important functionality within our solution.
Thank you.

@ATaglioni

The ticket was recently logged and we are afraid that we do not have information about its resolution ETA. As shared earlier, we will investigate and resolve it on first come first serve basis as per the free support policies. In case the issue is urgent and you need to get it resolved on urgent basis, you can kindly check our paid support option which is recommended for such showstoppers. In the meantime, we will surely inform you once we have some information.

We apologize for the inconvenience.