Author: ssteiner
Date: Wed Jul  6 08:27:51 2016
New Revision: 1751621

URL: http://svn.apache.org/viewvc?rev=1751621&view=rev
Log:
FOP-916: URL in basic-link is scrambled by encryption

Modified:
    xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java

Modified: 
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java?rev=1751621&r1=1751620&r2=1751621&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java 
(original)
+++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java 
Wed Jul  6 08:27:51 2016
@@ -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 + ")";
+        }
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to