We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Superscript

Could you please give me a sample code to create the following inline text in Aspose.Pdf (not generator API)?


XYZOW ®Financial Report

Registered mark should be a superscript.

Thanks,
Anil

Hi Anil,


Thanks for contacting support.

In order to render SuperScript text using new DOM approach, please try using HtmlFragment instance. Please take a look over following code snippet. For your reference, I have also attached the resultant PDF generated over my end.

[C#]

Document doc = new Document();<o:p></o:p>

doc.Pages.Add();

HtmlFragment html = new HtmlFragment("

XYZOW ®Financial Report

");

doc.Pages[1].Paragraphs.Add(html);

doc.Save(“c:/pdftest/SuperScript_Text.pdf”);

str = "

TEST®TEST

";
HtmlFragment text = new HtmlFragment(str);

I have problems with this piece of HTML. Could you please help me troubleshoot it?

Thanks
Anil

Hi Anil,


Thanks for your inquiry. I have tested your scenario with Aspose.Pdf for .NET 10.3.0 and unable to notice any issue. Please download and try latest version of Aspose.Pdf for .NET, if issue persist then please share some more details, so we will look into it and guide you accordingly.

Document doc = new
Document();<o:p></o:p>

doc.Pages.Add();

HtmlFragment html = new HtmlFragment("TEST®TEST

");

doc.Pages[1].Paragraphs.Add(html);

doc.Save(myDir+"SuperScript_Text.pdf");


Please feel free to contact us for any further assistance.


Best Regards,

[Test]
public void ShouldGenerateSuperScript()
{
Document doc = new Document();
doc.Pages.Add();
string htmlstr = "

TEST®TEST

";
//string htmlstr = "

TEST®TEST

";
HtmlFragment html = new HtmlFragment(htmlstr);
doc.Pages[1].Paragraphs.Add(html);
string tmpFolder = Path.GetTempPath();
string tmpFile = Path.Combine(tmpFolder, "SuperScript_Text.pdf");
doc.Save(tmpFile);
}

I upgraded to 10.3 and I have the same issue. The problem is with the font. It works for Arial, Times New Roman, but not for the font I am looking for.

Attached the sample output.

Hi,


Thanks for sharing the details.

I
have tested the scenario and I am able to reproduce the same problem that SuperScript is not being honored when using custom font (font other than Arial, Times New Roman). For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-38527. We
will investigate this issue in details and will keep you updated on the status
of a correction.

We apologize for your inconvenience.

The issues you have found earlier (filed as PDFNET-38527) have been fixed in Aspose.PDF for .NET 18.11.