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

Free Support Forum - aspose.com

Problem with Mathematical equations while generating PDF

Hi,

We have a problem with mathematical formulas using Aspose.words.jdk16 for java,(version 17.7) I am not able to print some mathematical formulas and getting error while generating pdf.

    Document doc = new Document();
	DocumentBuilder docBuilder = new DocumentBuilder(doc);
	String mathEquation1  = "<math xmlns='http://www.w3.org/1998/Math/MathML' display='block'>  
           <mfrac linethickness='3px'>    <mfrac bevelled='true'>      <mn>1</mn>      <mi>x</mi>    
           </mfrac>    <mrow>      <mi>y</mi>      <mo>&minus;</mo>      <mn>2</mn>    </mrow>  </mfrac></math>";
	String mathEquation2  = "<math xmlns='http://www.w3.org/1998/Math/MathML'>  <msup>    <mrow>      <mo>(</mo>        <mrow>          <mrow><mn>3</mn><mi>x</mi></mrow>          <mo>-</mo>          <mrow><mn>2</mn><mi>y</mi></mrow>        </mrow>      <mo>)</mo>    </mrow>    <mn>2</mn>  </msup></math>";
	String mathEquation3 = "<math xmlns='http://www.w3.org/1998/Math/MathML'> <mrow>   <msup>     <mfenced>       <mrow>         <mi>a</mi>         <mo>+</mo>         <mi>b</mi>       </mrow>     </mfenced>     <mn>2</mn>   </msup> </mrow> </math>";
	
	docBuilder.insertHtml(mathEquation1);
	docBuilder.insertHtml("<br>");
	docBuilder.insertHtml(mathEquation2);
	docBuilder.insertHtml("<br>");
	docBuilder.insertHtml(mathEquation3);
	doc.updateFields();
    doc.save("D:\\MathEquation.pdf");

@Prahalad,

Thanks for your inquiry. We have tested the scenario with your shared code and noticed the reported issue. We have logged a ticket WORDSNET-15648 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience.

Best Regards,

@tilal.ahmad Regressions cost us a lot. When could we get fix estimates for this?

@kumaraswamy.m,

Currently, this issue is pending for analysis and is in the queue. We will inform you via this thread as soon as this issue is resolved or any estimates are available. We apologize for any inconvenience

Please also provide a little more information about the old Aspose.Words’ version number for which there were no problems on your side previously.

Best regards,
Awais Hafeez

@awais.hafeez ,
There were no problems with Aspose.words 16.7 & 17.5 . I have no idea about 17.6 Because I didn’t check
17.6.

@Prahalad,

Thanks for the additional information. We have passed your concerns to our product team and will let you know via this thread as soon as this issue is resolved. We apologize for your inconvenience.

Best regards,
Awais Hafeez

@Prahalad,

We have a good news for you i.e. our product team has resolved your issue (WORDSNET-15648) and they have planned to include the fix to this issue in next [17.8.0 - Aug 2017] release of Aspose.Words. We will inform you via this thread as soon as next release containing the fix of this issue will be published during the start of next month.

Best regards,
Awais Hafeez

Thanks @awais.hafeez ,

Regards,
Prahalad

@awais.hafeez,
Could you please tell me the expected date of 17.8.0 release ? So I can make my aspose tasks according to release date.

@Prahalad,

Aspose.Words 17.8 will most likely be released during the second week of next month.

We will inform you via this thread as soon as next release containing the fix of this issue will be published.

Best regards,
Awais Hafeez

@awais.hafeez ,

I got the Aspose 17.7.1 hotfix for my issue. I have checked the aspose 17.7.1.
Aspose team has resolved the issue. But some minor issue I am facing again.Now Equations are coming, But they are not left aligned.They are coming in center aligned by default.

it should come left aligned by default.

@Prahalad

Thanks for your feedback. We are looking into the issue and will guide you accordingly.

@Prahalad,

Regarding alignment issue, please use the following code:

NodeCollection maths = doc.GetChildNodes(NodeType.OfficeMath, true);
foreach (OfficeMath math in maths)
{
    if ((math.ParentNode.NodeType != NodeType.OfficeMath))
    {
        math.DisplayType = OfficeMathDisplayType.Display;
        math.Justification = OfficeMathJustification.Left;
    }
}

Best regards,
Awais Hafeez

Thanks @awais.hafeez ,

@Prahalad,

The issues you have found earlier (filed as WORDSNET-15648) have been fixed in this Aspose.Words for .NET 17.8 update and this Aspose.Words for Java 17.8 update.

Thanks @awais.hafeez