svn commit: r1753357 - in /xmlgraphics/fop/trunk: fop-core/src/main/java/org/apache/fop/pdf/PDFProfile.java fop-core/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java fop/test/xml/pdf-a/with-attachment.fo

[email protected]
Newsgroups gmane.text.xml.fop.cvs
Message-ID <[email protected]>
Author: ssteiner
Date: Tue Jul 19 09:25:55 2016
New Revision: 1753357

URL: http://svn.apache.org/viewvc?rev=1753357&view=rev
Log:
FOP-2625: Allow Attachments for PDF/A-3

Added:
    xmlgraphics/fop/trunk/fop/test/xml/pdf-a/with-attachment.fo   (with props)
Modified:
    xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/pdf/PDFProfile.java
    xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java

Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/pdf/PDFProfile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/pdf/PDFProfile.java?rev=1753357&r1=1753356&r2=1753357&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/pdf/PDFProfile.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/pdf/PDFProfile.java Tue Jul 19 09:25:55 2016
@@ -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()) {

Modified: xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java?rev=1753357&r1=1753356&r2=1753357&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java Tue Jul 19 09:25:55 2016
@@ -131,6 +131,20 @@ public class PDFAConformanceTestCase ext
         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<String, Object> params = new HashMap<String, Object>();
         params.put("pdfProfile", PDFAMode.PDFA_1B);

Added: xmlgraphics/fop/trunk/fop/test/xml/pdf-a/with-attachment.fo
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/test/xml/pdf-a/with-attachment.fo?rev=1753357&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/fop/test/xml/pdf-a/with-attachment.fo (added)
+++ xmlgraphics/fop/trunk/fop/test/xml/pdf-a/with-attachment.fo Tue Jul 19 09:25:55 2016
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fo:root xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="Gladiator">
+  <fo:layout-master-set>
+    <fo:simple-page-master master-name="y" margin-right="10mm" margin-left="5mm" margin-bottom="5mm" margin-top="5mm" page-width="21cm" page-height="29.7cm">
+      <fo:region-body/>
+    </fo:simple-page-master>
+    <fo:page-sequence-master master-name="x">
+      <fo:repeatable-page-master-alternatives>
+        <fo:conditional-page-master-reference master-reference="y" page-position="any"/>
+      </fo:repeatable-page-master-alternatives>
+    </fo:page-sequence-master>
+  </fo:layout-master-set>
+  <fo:declarations>
+    <pdf:embedded-file filename="minimal-pdf-a.fo" src="xml/pdf-a/minimal-pdf-a.fo"/>
+  </fo:declarations>
+  <fo:page-sequence master-reference="x">
+    <fo:flow flow-name="xsl-region-body">
+      <fo:block>xx</fo:block>
+    </fo:flow>
+  </fo:page-sequence>
+</fo:root>

Propchange: xmlgraphics/fop/trunk/fop/test/xml/pdf-a/with-attachment.fo
------------------------------------------------------------------------------
    svn:eol-style = native
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.