MATLAB: How to use MATLAB Report Generator to produce PDF Report rather than HTML Report

fatal errorMATLABMATLAB Report Generatorpdfreport generator

I am running MATLAB R2016a on a Mac (OS X El Capitan). I am just getting started with MATLAB Report Generator. I have completed the tutorial in chapter 2 (Magic Squares) of the MATLAB® Report Generator™ User's Guide, and successfully generated the HTML report. (I am attaching a zip file that contains the magic_squares.rpt file.)
I then went back and changed the File Format of the report from Web (HTML) to Acrobat (PDF), then clicked the Report tool to generate the same report in PDF format (without making any other changes).
This time, the report failed with the messages below. Is there some reason I can generate an HTML report but not a PDF report? How can I fix this?
Converting report
FATAL: "fo:block" is not a valid child of "fo:root"! (See position -1:-1) org.apache.fop.fo.ValidationException: "fo:block" is not a valid child of "fo:root"! (See position -1:-1) Document conversion failed. Java exception occurred: ; SystemID: file:/Applications/MATLAB_R2016a.app/sys/namespace/docbook/v4/xsl/fo/mcode.xsl; Line#: 41; Column#: -1 javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException: "fo:block" is not a valid child of "fo:root"! (See position -1:-1) ...

Best Answer

The problem is with the Eval component at the beginning of the report. You have configured the Eval component to insert the expression to be evaluated and its output before the title page of the report:
This is invalid as the warning sign on the component dialog box indicates. HTML is forgiving of this error but PDF is not. The solution is to uncheck the check boxes that trigger this behavior:
Related Question