From: Simon Steiner Date: Tue, 19 Jul 2016 09:25:55 +0000 (+0000) Subject: FOP-2625: Allow Attachments for PDF/A-3 X-Git-Tag: fop-2_2~54 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a45831062894ceff471278afd761c955beeedc7c;p=xmlgraphics-fop.git FOP-2625: Allow Attachments for PDF/A-3 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1753357 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/fop-core/src/main/java/org/apache/fop/pdf/PDFProfile.java b/fop-core/src/main/java/org/apache/fop/pdf/PDFProfile.java index 18140a596..ef01a20b4 100644 --- a/fop-core/src/main/java/org/apache/fop/pdf/PDFProfile.java +++ b/fop-core/src/main/java/org/apache/fop/pdf/PDFProfile.java @@ -332,7 +332,7 @@ public class PDFProfile { /** Checks if embedded files are allowed. */ public void verifyEmbeddedFilesAllowed() { final String err = "{0} does not allow embedded files."; - if (isPDFAActive()) { + if (isPDFAActive() && getPDFAMode().getPart() < 3) { throw new PDFConformanceException(format(err, getPDFAMode())); } if (isPDFXActive()) { diff --git a/fop-core/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java b/fop-core/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java index 752d666c5..acd480615 100644 --- a/fop-core/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java @@ -131,6 +131,20 @@ public class PDFAConformanceTestCase extends BasePDFTest { eventChecker.end(); } + @Test + public void testAttachment() throws Exception { + File foFile = new File(foBaseDir, "with-attachment.fo"); + try { + convertFO(foFile, getUserAgent(), dumpPDF); + fail("Expected PDFConformanceException. PDF/A-1 does not allow attachments."); + } catch (PDFConformanceException e) { + //Good! + } + FOUserAgent ua = getUserAgent(); + ua.getRendererOptions().put("pdf-a-mode", "PDF/A-3a"); + convertFO(foFile, ua, dumpPDF); + } + private EventChecker setupEventChecker(FOUserAgent ua, String expectedEvent) { Map params = new HashMap(); params.put("pdfProfile", PDFAMode.PDFA_1B); diff --git a/fop/test/xml/pdf-a/with-attachment.fo b/fop/test/xml/pdf-a/with-attachment.fo new file mode 100644 index 000000000..f922c8977 --- /dev/null +++ b/fop/test/xml/pdf-a/with-attachment.fo @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + xx + + +