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

Free Support Forum - aspose.com

Text Formatting - Square Meter

This might be a dumb question, but here it goes. I'm currently trying to get the 2 in "m2" to be raised (as in square meter) so as to display the correctly formatted unit in the final saved pdf, but I can't seem to find a good way of doing it. Any suggestions on this? It is probably quite easy, but I fail to find the correct solution.

Thanks in advance.

Hello Henric,

Thanks for using our products.

Please try using the following code snippet to accomplish your requirement. I have also attached the resultant PDF for your reference. Please take a look.


//Instantiate Pdf object by calling its empty constructor
Pdf pdf1 = new Pdf();
//Create a section in the Pdf object
Aspose.Pdf.Section section1 = pdf1.Sections.Add();
//Create a new text paragraph with an initial text segment "Aspose"

Text text1 = new Text(section1,"m");
//Add the text paragraph to the section

//Create a new text segment into the text paragraph
Segment segent2 = text1.Segments.Add("2");
//Set the vertical alignment of text segment "seg2" to Topline by setting
//IsBaseline property ot seg2.TextInfo to true
segent2.TextInfo.IsBaseline = false;
// set the font size information for the segment
segent2.TextInfo.FontSize = 6;

//Save the Pdf

For more information on related topic, please visit Set Vertical Alignment of Paragraph to Baseline or Topline

In case it does not satisfy your requirement or you have any further query, please feel free to contact.

Thank you codewarrior, that should do the trick. I haven’t had the time to test it yet, but it will probably be just what I need. :slight_smile: