diff options
Diffstat (limited to 'fop-core')
-rw-r--r-- | fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java b/fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java index a42b9c872..bc17dd997 100644 --- a/fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java +++ b/fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java @@ -49,7 +49,7 @@ public class PDFUri extends PDFAction { } private String getDictString() { - return "<< /URI (" + encodeString(uri) + ")\n/S /URI >>"; + return "<< /URI " + encodeURI(uri) + "\n/S /URI >>"; } /** {@inheritDoc} */ @@ -58,4 +58,13 @@ public class PDFUri extends PDFAction { return getDictString(); } + private String encodeURI(String text) { + if (getDocument() != null && getDocumentSafely().isEncryptionActive()) { + final byte[] buf = PDFText.encode(text); + byte[] enc = getDocument().getEncryption().encrypt(buf, this); + return PDFText.toHex(enc, true); + } else { + return "(" + text + ")"; + } + } } |