I am trying to convert a XSL-FO file with MathML to PDF using Apache FOP 2.1 but I get a few warnings and errors.
How can I get MathML to be printed to PDF using FOP?
My Test.fo
file:
<?xml version="1.0" encoding="iso-8859-1"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns="http://www.w3.org/1998/Math/MathML">
<fo:layout-master-set>
<fo:simple-page-master master-name="my-page">
<fo:region-body margin="1in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="my-page">
<fo:flow flow-name="xsl-region-body" font="12pt Times">
<fo:block font-size="1.5em" font-weight="bold" role="html:p">
<fo:instream-foreign-object>
<math display="inline">
<mrow>
<mi>A</mi>
<mo>=</mo>
<mi>Ï€</mi>
<msup>
<mi>r</mi>
<mn>2</mn>
</msup>
</mrow>
</math>
</fo:instream-foreign-object>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
The output I get:
$ fop test.fo 123.pdf
Sep 30, 2016 1:45:12 PM org.apache.fop.events.LoggingEventListener processEvent WARNING: Unknown formatting object "{http://www.w3.org/1998/Math/MathML}math" encountered (a child of fo:instream-foreign-object}. (See position 13:72)
Sep 30, 2016 1:45:12 PM org.apache.fop.events.LoggingEventListener processEvent WARNING: Unknown formatting object "{http://www.w3.org/1998/Math/MathML}mrow" encountered (a child of math}. (See position 14:13)
Sep 30, 2016 1:45:12 PM org.apache.fop.events.LoggingEventListener processEvent WARNING: Unknown formatting object "{http://www.w3.org/1998/Math/MathML}mi" encountered (a child of mrow}. (See position 15:12)
Sep 30, 2016 1:45:12 PM org.apache.fop.events.LoggingEventListener processEvent WARNING: Unknown formatting object "{http://www.w3.org/1998/Math/MathML}mo" encountered (a child of mrow}. (See position 16:12)
Sep 30, 2016 1:45:12 PM org.apache.fop.events.LoggingEventListener processEvent WARNING: Unknown formatting object "{http://www.w3.org/1998/Math/MathML}mi" encountered (a child of mrow}. (See position 17:12)
Sep 30, 2016 1:45:12 PM org.apache.fop.events.LoggingEventListener processEvent WARNING: Unknown formatting object "{http://www.w3.org/1998/Math/MathML}msup" encountered (a child of mrow}. (See position 18:14)
Sep 30, 2016 1:45:12 PM org.apache.fop.events.LoggingEventListener processEvent WARNING: Unknown formatting object "{http://www.w3.org/1998/Math/MathML}mi" encountered (a child of msup}. (See position 19:13)
Sep 30, 2016 1:45:12 PM org.apache.fop.events.LoggingEventListener processEvent WARNING: Unknown formatting object "{http://www.w3.org/1998/Math/MathML}mn" encountered (a child of msup}. (See position 20:13)
Sep 30, 2016 1:45:12 PM org.apache.fop.events.LoggingEventListener processEvent SEVERE: The intrinsic dimensions of an instream-foreign-object could not be determined. (See position 12:33)
Sep 30, 2016 1:45:13 PM org.apache.fop.events.LoggingEventListener processEvent INFO: Rendered page #1.
The output PDF is empty.