Hello everybody, I'm trying to use FOP to generate a PDF file which passes both the PDF/A-2a and the PDF/UA-1 verifications and also contains a custom XMP extension schema.
I described the problem in one of my previous e-mails and also attached a zip archive with the template and configuration files for reproducing it. I also described two possible solutions, but I can't implement them myself. I have since tried FOP 2.11 and it seems to have the same issue. Can someone please take a look at this issue and hopefully solve it for the next version of xmlgraphics? Thank you very much! Michael Schubert From: Michael Schubert <[email protected]> Sent: Friday, November 21, 2025 16:14 To: [email protected] Subject: RE: Custom XMP Extension Schema dropped when generating PDF/A-2a and PDF/UA-1 compatible PDF NTT DATA Security Awareness - This is an incoming mail from an EXTERNAL SENDER (fop-dev-return-55718-michael.schubert=nttdata....@xmlgraphics.apache.org<mailto:fop-dev-return-55718-michael.schubert=nttdata....@xmlgraphics.apache.org>). Please verify sender before you open attachments or access links. ________________________________ I have two possible solutions, both of them need some changes to be made in xmlgraphics-commons: First solution - doesn't add the pdfuaid extension schema automatically any more, so that the other extension schemas from the .fo get added properly; the pdfuaid extension schema then needs to be defined in the .fo file: Changed PDFAExtensionAdapter so that the only thing done in the constructor is the call to super. The "pdfuaid" schema then needs to be defined manually in the report.fo. (I also hat to modify a test class in order to be able to build the project; I simply disabled the test with @Ignore.) Second solution - the pdfuaid extension schema gets added automatically, but the other schemas also get added because of the ArrayAddPropertyMerger rule; some minor changes were needed in order to make sure that the xmlLanguage and the parseType also get merged from one array to the other: Changed PDFAExtensionAdapter so that the last few lines in the constructor look like this: QName qname = new QName(namespace, SCHEMAS); XMPProperty prop = new XMPProperty(qname, array); XMPSchemaRegistry.getInstance().getSchema(namespace).getDefaultMergeRuleSet().addRule(qname, new ArrayAddPropertyMerger()); meta.setProperty(prop); Which mean that any extension schemas in the .fo get added to the definitions and are not simply discarded. I hat to define two new methods in XMPArray: public String getXMLLang(int idx) { return (String)this.xmllang.get(idx); } public String getParseType(int idx) { return this.parseTypes.get(idx); } And I also changed the ArrayAddPropertyMerger, so that the language and parseType too get merged from one array to another. The last line now looks like this: array.add(otherArray.getValue(i), otherArray.getXMLLang(i), otherArray.getParseType(i)); (There was also a TODO comment right at this place, which I think meant exactly something like this modification.) Both solutions work if I exchange the xmlgraphics-commons-2.10.jar from the fop/lib folder with the one I generated by building the modified project with "ant". The generated PDF passes both validations, the one for PDF/A-2a and the one for PDF/UA-1.
