diff --git a/src/main/java/org/metanorma/fop/PDFGenerator.java b/src/main/java/org/metanorma/fop/PDFGenerator.java index d1e4630..a6599cf 100644 --- a/src/main/java/org/metanorma/fop/PDFGenerator.java +++ b/src/main/java/org/metanorma/fop/PDFGenerator.java @@ -580,7 +580,12 @@ private void runFOP (fontConfig fontcfg, Source src, File pdf) throws IOExceptio FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); // configure foUserAgent foUserAgent.setProducer("Ribose Metanorma mn2pdf version " + Util.getAppVersion()); - foUserAgent.getRendererOptions().put("pdf-a-mode", PDF_A_MODE); + if (encryptionParams.isEmpty()) { + foUserAgent.getRendererOptions().put("pdf-a-mode", PDF_A_MODE); + } else { + logger.severe("PDF/A doesn't allow encrypted PDFs. PDF will be generated in non-PDF/A mode."); + } + setEncryptionParams(foUserAgent); //Adding a simple logging listener that writes to stdout and stderr