aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/pdf/PDFGoToRemote.java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2010-08-16 09:39:34 +0000
committerJeremias Maerki <jeremias@apache.org>2010-08-16 09:39:34 +0000
commitcb9936b4c92ee6f4dede21dbd2fe6d3395b9c31c (patch)
tree4e022c5663696161f5d32fc858c633d4390ae891 /src/java/org/apache/fop/pdf/PDFGoToRemote.java
parentefea814f6945dd13595a4d6767ebf6b57f68df1b (diff)
downloadxmlgraphics-fop-cb9936b4c92ee6f4dede21dbd2fe6d3395b9c31c.tar.gz
xmlgraphics-fop-cb9936b4c92ee6f4dede21dbd2fe6d3395b9c31c.zip
Improvements/Bugfixes for PDF attachments (embedded files):
- Acrobat doesn't like indirect objects for the /Length entry of embedded files (make on-the-fly generation more easily configurable). - Added the /Size entry for embedded files to keep Acrobat happy. - Moved the embedded files' Names tree to the end of the PDF to be on the safe side. - Made hyperlinks to embedded files work by using a JavaScript Action (thanks to Matthias Reischenbacher for that idea). - Added sorting to the names tree node because Acrobat relies on it. - Added some filename manipulation code to work around possible encoding problems with special characters in the filenames. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@985843 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/pdf/PDFGoToRemote.java')
-rw-r--r--src/java/org/apache/fop/pdf/PDFGoToRemote.java25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFGoToRemote.java b/src/java/org/apache/fop/pdf/PDFGoToRemote.java
index ee7660875..93fbe47de 100644
--- a/src/java/org/apache/fop/pdf/PDFGoToRemote.java
+++ b/src/java/org/apache/fop/pdf/PDFGoToRemote.java
@@ -27,7 +27,7 @@ public class PDFGoToRemote extends PDFAction {
/**
* the file specification
*/
- private PDFFileSpec pdfFileSpec;
+ private PDFReference pdfFileSpec;
private int pageReference = 0;
private String destination = null;
private boolean newWindow = false;
@@ -43,12 +43,12 @@ public class PDFGoToRemote extends PDFAction {
/* generic creation of object */
super();
- this.pdfFileSpec = pdfFileSpec;
+ this.pdfFileSpec = pdfFileSpec.makeReference();
this.newWindow = newWindow;
}
/**
- * create an GoToR object.
+ * Create an GoToR object.
*
* @param pdfFileSpec the fileSpec associated with the action
* @param page a page reference within the remote document
@@ -56,7 +56,18 @@ public class PDFGoToRemote extends PDFAction {
* displayed in a new window
*/
public PDFGoToRemote(PDFFileSpec pdfFileSpec, int page, boolean newWindow) {
- /* generic creation of object */
+ this(pdfFileSpec.makeReference(), page, newWindow);
+ }
+
+ /**
+ * Create an GoToR object.
+ *
+ * @param pdfFileSpec the fileSpec associated with the action
+ * @param page a page reference within the remote document
+ * @param newWindow boolean indicating whether the target should be
+ * displayed in a new window
+ */
+ public PDFGoToRemote(PDFReference pdfFileSpec, int page, boolean newWindow) {
super();
this.pdfFileSpec = pdfFileSpec;
@@ -76,7 +87,7 @@ public class PDFGoToRemote extends PDFAction {
/* generic creation of object */
super();
- this.pdfFileSpec = pdfFileSpec;
+ this.pdfFileSpec = pdfFileSpec.makeReference();
this.destination = dest;
this.newWindow = newWindow;
}
@@ -97,7 +108,7 @@ public class PDFGoToRemote extends PDFAction {
StringBuffer sb = new StringBuffer(64);
sb.append(getObjectID());
sb.append("<<\n/S /GoToR\n/F ");
- sb.append(pdfFileSpec.referencePDF());
+ sb.append(pdfFileSpec.toString());
sb.append("\n");
if (destination != null) {
@@ -139,7 +150,7 @@ public class PDFGoToRemote extends PDFAction {
PDFGoToRemote remote = (PDFGoToRemote)obj;
- if (!remote.pdfFileSpec.referencePDF().equals(pdfFileSpec.referencePDF())) {
+ if (!remote.pdfFileSpec.toString().equals(pdfFileSpec.toString())) {
return false;
}