aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2016-07-19 14:03:02 +0000
committerSimon Steiner <ssteiner@apache.org>2016-07-19 14:03:02 +0000
commitc245cc77cfa63389e419387b98de44a90ee4156e (patch)
treea0c4b2201f0200cee8dd0ecbf4fb4b226e1dc432
parenta45831062894ceff471278afd761c955beeedc7c (diff)
downloadxmlgraphics-fop-c245cc77cfa63389e419387b98de44a90ee4156e.tar.gz
xmlgraphics-fop-c245cc77cfa63389e419387b98de44a90ee4156e.zip
FOP-2625: Allow Attachments for PDF/A-3
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1753394 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--fop-core/src/main/java/org/apache/fop/pdf/PDFEmbeddedFile.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/pdf/PDFRoot.java12
-rw-r--r--fop-core/src/main/java/org/apache/fop/render/pdf/PDFRenderingUtil.java1
3 files changed, 14 insertions, 1 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/pdf/PDFEmbeddedFile.java b/fop-core/src/main/java/org/apache/fop/pdf/PDFEmbeddedFile.java
index ae6893944..035c6cdbc 100644
--- a/fop-core/src/main/java/org/apache/fop/pdf/PDFEmbeddedFile.java
+++ b/fop-core/src/main/java/org/apache/fop/pdf/PDFEmbeddedFile.java
@@ -33,8 +33,10 @@ public class PDFEmbeddedFile extends PDFStream {
public PDFEmbeddedFile() {
super();
put("Type", new PDFName("EmbeddedFile"));
+ put("Subtype", new PDFName("application/octet-stream"));
PDFDictionary params = new PDFDictionary();
params.put("CreationDate", PDFInfo.formatDateTime(new Date()));
+ params.put("ModDate", PDFInfo.formatDateTime(new Date()));
put("Params", params);
}
diff --git a/fop-core/src/main/java/org/apache/fop/pdf/PDFRoot.java b/fop-core/src/main/java/org/apache/fop/pdf/PDFRoot.java
index 32edc34fc..5077ba68b 100644
--- a/fop-core/src/main/java/org/apache/fop/pdf/PDFRoot.java
+++ b/fop-core/src/main/java/org/apache/fop/pdf/PDFRoot.java
@@ -53,7 +53,7 @@ public class PDFRoot extends PDFDictionary {
private final PDFDocument document;
private PDFDPartRoot dPartRoot;
-
+ private PDFArray af;
private static final PDFName[] PAGEMODE_NAMES = new PDFName[] {
new PDFName("UseNone"),
@@ -333,4 +333,14 @@ public class PDFRoot extends PDFDictionary {
}
return dPartRoot;
}
+
+ public void addAF(PDFFileSpec fileSpec, String filename) {
+ if (af == null) {
+ af = new PDFArray();
+ put("AF", af);
+ }
+ af.add(fileSpec);
+ fileSpec.put("UF", filename);
+ fileSpec.put("AFRelationship", new PDFName("Data"));
+ }
}
diff --git a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFRenderingUtil.java b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFRenderingUtil.java
index 18a804b5d..e870b3469 100644
--- a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFRenderingUtil.java
+++ b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFRenderingUtil.java
@@ -679,6 +679,7 @@ class PDFRenderingUtil {
dict.put("F", file);
String filename = PDFText.toPDFString(embeddedFile.getFilename(), '_');
PDFFileSpec fileSpec = new PDFFileSpec(filename);
+ pdfDoc.getRoot().addAF(fileSpec, filename);
fileSpec.setEmbeddedFile(dict);
if (embeddedFile.getDesc() != null) {
fileSpec.setDescription(embeddedFile.getDesc());