diff options
author | Jeremias Maerki <jeremias@apache.org> | 2010-08-03 13:44:54 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2010-08-03 13:44:54 +0000 |
commit | 3800fbcd385314883c58c7ca69ceea56ad39e538 (patch) | |
tree | 72c862829dc28c62592ffe1bc4113450edfc991e /src/java/org/apache/fop/pdf/PDFFileSpec.java | |
parent | 06dd1be43df5f16d023abf3b5673fbfc43b3a4df (diff) | |
download | xmlgraphics-fop-3800fbcd385314883c58c7ca69ceea56ad39e538.tar.gz xmlgraphics-fop-3800fbcd385314883c58c7ca69ceea56ad39e538.zip |
Bugzilla #44460:
Added support for PDF file attachments (embedded files) including basic-link support to reference them.
Based on work submitted by: Andrejus Chaliapinas <a.chaliapinas.at.infosana.com>
I've changed and improved his patch extensively and added some documentation.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@981875 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/pdf/PDFFileSpec.java')
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFFileSpec.java | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFFileSpec.java b/src/java/org/apache/fop/pdf/PDFFileSpec.java index 8de4164af..44195d4ee 100644 --- a/src/java/org/apache/fop/pdf/PDFFileSpec.java +++ b/src/java/org/apache/fop/pdf/PDFFileSpec.java @@ -19,16 +19,12 @@ package org.apache.fop.pdf; + /** * class representing a /FileSpec object. * */ -public class PDFFileSpec extends PDFObject { - - /** - * the filename - */ - protected String filename; +public class PDFFileSpec extends PDFDictionary { /** * create a /FileSpec object. @@ -39,29 +35,30 @@ public class PDFFileSpec extends PDFObject { /* generic creation of object */ super(); + put("Type", new PDFName("Filespec")); + put("F", filename); + } - this.filename = filename; + private String getFilename() { + return (String)get("F"); } /** - * {@inheritDoc} + * Associates an dictionary with pointers to embedded file streams with this file spec. + * @param embeddedFile the dictionary with pointers to embedded file streams */ - public String toPDFString() { - return getObjectID() - + "<<\n/Type /FileSpec\n" - + "/F (" + this.filename + ")\n" - + ">>\nendobj\n"; + public void setEmbeddedFile(PDFDictionary embeddedFileDict) { + put("EF", embeddedFileDict); } - /* - * example - * 29 0 obj - * << - * /Type /FileSpec - * /F (table1.pdf) - * >> - * endobj + /** + * Sets a description for the file spec. + * @param description the description + * @since PDF 1.6 */ + public void setDescription(String description) { + put("Desc", description); + } /** {@inheritDoc} */ protected boolean contentEquals(PDFObject obj) { @@ -75,7 +72,7 @@ public class PDFFileSpec extends PDFObject { PDFFileSpec spec = (PDFFileSpec)obj; - if (!spec.filename.equals(filename)) { + if (!spec.getFilename().equals(getFilename())) { return false; } |