aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2016-07-19 09:25:55 +0000
committerSimon Steiner <ssteiner@apache.org>2016-07-19 09:25:55 +0000
commita45831062894ceff471278afd761c955beeedc7c (patch)
tree8f91a375e7a794cdc82d39ff7ae040745d2d7c1f
parentb17e8ee9337d306fef0f7f3bb439c8f54078b6f2 (diff)
downloadxmlgraphics-fop-a45831062894ceff471278afd761c955beeedc7c.tar.gz
xmlgraphics-fop-a45831062894ceff471278afd761c955beeedc7c.zip
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
-rw-r--r--fop-core/src/main/java/org/apache/fop/pdf/PDFProfile.java2
-rw-r--r--fop-core/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java14
-rw-r--r--fop/test/xml/pdf-a/with-attachment.fo21
3 files changed, 36 insertions, 1 deletions
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<String, Object> params = new HashMap<String, Object>();
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 @@
+<?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>