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.
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.
[C#]
//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 section1.Paragraphs.Add(text1);
//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 pdf1.Save(@"d:/pdftest/Vertical_Alignment_of_Text.pdf");