diff options
author | Simon Steiner <ssteiner@apache.org> | 2016-07-19 14:03:02 +0000 |
---|---|---|
committer | Simon Steiner <ssteiner@apache.org> | 2016-07-19 14:03:02 +0000 |
commit | c245cc77cfa63389e419387b98de44a90ee4156e (patch) | |
tree | a0c4b2201f0200cee8dd0ecbf4fb4b226e1dc432 | |
parent | a45831062894ceff471278afd761c955beeedc7c (diff) | |
download | xmlgraphics-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
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()); |