I'm currently working on a module for a company project and am using Apache FOP 2.3 to generate pdfs from xmls.
I'm having issues working with FOP, when I try testing the implementation with our test files, FOP generates almost empty pdfs, their only content is :
%PDF-1.4 %клмн
and I'm getting a
org.apache.fop.fo.ValidationException: "fo:table-row" is missing child elements. Required content model: (table-cell+) (No context info available)
error. I've tried setting the strict validator to false in the fop.conf file but that didn't help with the exception.
This is my pdf generation code:
FopFactory fopFactory = FopFactory.newInstance(FOPCONFIGFILE);
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, destination);
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(new StreamSource(xslFile));
JDOMSource docEntreeJDOM = new JDOMSource(docJDOM);
org.w3c.dom.Document doc = transformJdomToDom(docJDOM);
Result result = new SAXResult(fop.getDefaultHandler());
transformer.transform(docEntreeJDOM, result);
The module use to use fop 0.20.5 and worked. However after changing to the latest version I've been having these issues.
I used the commandline version of Apache-FOP 2.3 on my xsl and example files to get more information from the logs (since eclipse doesn't give me the context or lines of the error).
I have since then corrected my xsl files and they produce the correct pdf output.