瀏覽代碼

FOP-916: URL in basic-link is scrambled by encryption

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1751621 13f79535-47bb-0310-9956-ffa450edef68
pull/3/head
Simon Steiner 8 年之前
父節點
當前提交
e00fef1ad1
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10
    1
      fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java

+ 10
- 1
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 + ")";
}
}
}

Loading…
取消
儲存