We have an application, which creates PDF files out of text-Files.
For math formula we are using MathML and converting this to MathOfficeML use DocumentFormat.OpenXML to create a word document.
After we have a word document, we converting it to PDF.
But since Aspose.Words version 20.8.0 the Brackets with Seperator are looking bad.
In our created word files they are looking good, but in the converted pdf file the are looking bad.
Our word looks like this:
image.png (6,3 KB)
The created pdf files looks like this:
image.png (3,3 KB)
I have written a test method to easily create the PDF file:
[TestMethod]
[DeploymentItem("Formula2.docx")]
public void TryFormulaToPdfTest()
{
var docxBytes = File.ReadAllBytes("Formula2.docx");
Document document;
using (var docxStream = new MemoryStream(docxBytes))
{
document = new Document(docxStream, new LoadOptions { LoadFormat = LoadFormat.Auto });
}
using (var pdfStream = new MemoryStream())
{
var saveOptions = new PdfSaveOptions
{
PreserveFormFields = true,
SaveFormat = SaveFormat.Pdf,
EmbedFullFonts = true
};
document.Save(pdfStream, saveOptions);
File.WriteAllBytes("Result.pdf", pdfStream.ToArray());
}
}
The content of the word document is this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh w16du wp14">
<w:body>
<w:p w14:paraId="1B34B331" w14:textId="505CF531" w:rsidR="005D6CD1" w:rsidRPr="00266362" w:rsidRDefault="00000000">
<w:pPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
<w:lang w:val="en-US"/>
</w:rPr>
</w:pPr>
<w:r w:rsidRPr="00266362">
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
<w:lang w:val="en-US"/>
</w:rPr>
<w:t xml:space="preserve">1: </w:t>
</w:r>
<m:oMath>
<m:d>
<m:dPr>
<m:begChr m:val="["/>
<m:sepChr m:val=","/>
<m:endChr m:val="]"/>
<m:ctrlPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
</w:rPr>
</m:ctrlPr>
</m:dPr>
<m:e>
<m:r>
<m:rPr>
<m:nor/>
</m:rPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
<w:lang w:val="en-US"/>
</w:rPr>
<m:t>2</m:t>
</m:r>
</m:e>
<m:e>
<m:r>
<m:rPr>
<m:nor/>
</m:rPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
<w:lang w:val="en-US"/>
</w:rPr>
<m:t>3</m:t>
</m:r>
</m:e>
</m:d>
</m:oMath>
</w:p>
<w:p w14:paraId="4FCB3125" w14:textId="77777777" w:rsidR="005D6CD1" w:rsidRPr="00266362" w:rsidRDefault="005D6CD1">
<w:pPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
<w:lang w:val="en-US"/>
</w:rPr>
</w:pPr>
</w:p>
<w:p w14:paraId="346516F2" w14:textId="5194B127" w:rsidR="00266362" w:rsidRDefault="00266362" w:rsidP="00266362">
<w:pPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
<w:lang w:val="en-US"/>
</w:rPr>
<w:t>2</w:t>
</w:r>
<w:r w:rsidR="00000000" w:rsidRPr="00266362">
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
<w:lang w:val="en-US"/>
</w:rPr>
<w:t xml:space="preserve">: </w:t>
</w:r>
<m:oMath>
<m:d>
<m:dPr>
<m:begChr m:val="{"/>
<m:sepChr m:val=","/>
<m:endChr m:val="}"/>
<m:ctrlPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
</w:rPr>
</m:ctrlPr>
</m:dPr>
<m:e>
<m:r>
<m:rPr>
<m:nor/>
</m:rPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
<w:lang w:val="en-US"/>
</w:rPr>
<m:t>2</m:t>
</m:r>
</m:e>
<m:e>
<m:r>
<m:rPr>
<m:nor/>
</m:rPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
<w:lang w:val="en-US"/>
</w:rPr>
<m:t>3</m:t>
</m:r>
</m:e>
</m:d>
</m:oMath>
</w:p>
<w:p w14:paraId="6CF67613" w14:textId="77777777" w:rsidR="00266362" w:rsidRDefault="00266362" w:rsidP="00266362">
<w:pPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
</w:rPr>
</w:pPr>
</w:p>
<w:p w14:paraId="52D524BB" w14:textId="7A3D9EA6" w:rsidR="00266362" w:rsidRDefault="00266362" w:rsidP="00266362">
<w:pPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
</w:rPr>
<w:t xml:space="preserve">3: </w:t>
</w:r>
<m:oMath>
<m:d>
<m:dPr>
<m:begChr m:val="["/>
<m:endChr m:val="]"/>
<m:ctrlPr>
<w:rPr>
<w:rFonts w:ascii="Cambria Math" w:hAnsi="Cambria Math" w:cstheme="minorBidi"/>
<w:i/>
</w:rPr>
</m:ctrlPr>
</m:dPr>
<m:e>
<m:r>
<w:rPr>
<w:rFonts w:ascii="Cambria Math" w:hAnsi="Cambria Math" w:cstheme="minorBidi"/>
</w:rPr>
<m:t>2,3</m:t>
</m:r>
</m:e>
</m:d>
</m:oMath>
</w:p>
<w:p w14:paraId="0C420BAA" w14:textId="77777777" w:rsidR="00266362" w:rsidRDefault="00266362" w:rsidP="00266362">
<w:pPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
</w:rPr>
</w:pPr>
</w:p>
<w:p w14:paraId="48966EC8" w14:textId="58E67B7C" w:rsidR="00266362" w:rsidRPr="00266362" w:rsidRDefault="00266362" w:rsidP="00266362">
<w:pPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:asciiTheme="minorBidi" w:hAnsiTheme="minorBidi" w:cstheme="minorBidi"/>
</w:rPr>
<w:t xml:space="preserve">4: </w:t>
</w:r>
<m:oMath>
<m:d>
<m:dPr>
<m:begChr m:val="{"/>
<m:endChr m:val="}"/>
<m:ctrlPr>
<w:rPr>
<w:rFonts w:ascii="Cambria Math" w:hAnsi="Cambria Math" w:cstheme="minorBidi"/>
<w:i/>
</w:rPr>
</m:ctrlPr>
</m:dPr>
<m:e>
<m:r>
<w:rPr>
<w:rFonts w:ascii="Cambria Math" w:hAnsi="Cambria Math" w:cstheme="minorBidi"/>
</w:rPr>
<m:t>2,3</m:t>
</m:r>
</m:e>
</m:d>
</m:oMath>
</w:p>
<w:sectPr w:rsidR="00266362" w:rsidRPr="00266362" w:rsidSect="00EE1830">
<w:headerReference w:type="even" r:id="rId7"/>
<w:headerReference w:type="default" r:id="rId8"/>
<w:footerReference w:type="even" r:id="rId9"/>
<w:footerReference w:type="default" r:id="rId10"/>
<w:headerReference w:type="first" r:id="rId11"/>
<w:footerReference w:type="first" r:id="rId12"/>
<w:pgSz w:w="11906" w:h="16838"/>
<w:pgMar w:top="1417" w:right="1417" w:bottom="1134" w:left="1417" w:header="708" w:footer="708" w:gutter="0"/>
<w:cols w:space="708"/>
<w:docGrid w:linePitch="360"/>
</w:sectPr>
</w:body>
</w:document>
This means that the sepChr has not been converted correctly to pdf. Or the scaling is not correct.
I have tried Aspose.Word up to version 24.9.0, but so far the problem is there.
Thanks for helping.