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

Free Support Forum - aspose.com

Math expression

Hi,
i have a problem with displaying math expressions like 3 to the power of 2 (3^2) with aspose.pdf. As i understand, math functions and expressions are not supported in aspose.pdf at all.
Please, could you help me in that. How can i display math expressions correct with aspose?
Thanks a lot in advance,
Alex

Hi Alex,


Thanks for contacting support.

In order to accomplish your requirement, please try using the following code snippet. For your reference, I have also attached the resultant PDF generated over my end using latest release of Aspose.Pdf for .NET 9.3.0.

[C#]

//Instantiate Pdf object by calling its
empty constructor
<o:p></o:p>

Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

//Create a section in the Pdf object

Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

//Create a new text paragraph with an initial text segment "Aspose"

Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(sec1,"3");

//Add the text paragraph to the section

sec1.Paragraphs.Add(text1);

//Create a new text segment into the text paragraph

Aspose.Pdf.Generator.Segment seg2 = text1.Segments.Add("^2");

//Set the vertical alignment of text segment "seg2" to Topline by setting

//IsBaseline property ot seg2.TextInfo to true

seg2.TextInfo.IsBaseline=false;

// set the font size information for the segment

seg2.TextInfo.FontSize = 5;

//Save the Pdf

pdf1.Save("c:/pdftest/MathematicalExpression.pdf");

Thank you very much! it works for me :slight_smile: