[ 
https://issues.apache.org/jira/browse/FOP-3258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17956624#comment-17956624
 ] 

Julien Lacour edited comment on FOP-3258 at 6/6/25 3:19 PM:
------------------------------------------------------------

Although not ideal, calling {{PDFObject.encodeText}} and encoding the result in 
{{PDFLink}} works:
{code:java}
if (altText != null && !altText.isEmpty()) {
    String contents = PDFText.escapeText(altText);
    if (getDocumentSafely().isEncryptionActive()) {
      contents = new String(encodeText(altText), StandardCharsets.ISO_8859_1);
    }
    dict += "/Contents " + contents + "\n";
}
{code}



was (Author: JIRAUSER300900):
Although not ideal, calling {{PDFObject.encodeText}} and encoding the result 
works:
{code:java}
if (altText != null && !altText.isEmpty()) {
    String contents = PDFText.escapeText(altText);
    if (getDocumentSafely().isEncryptionActive()) {
      contents = new String(encodeText(altText), StandardCharsets.ISO_8859_1);
    }
    dict += "/Contents " + contents + "\n";
}
{code}


> Links alt text is scrambled by encryption
> -----------------------------------------
>
>                 Key: FOP-3258
>                 URL: https://issues.apache.org/jira/browse/FOP-3258
>             Project: FOP
>          Issue Type: Bug
>            Reporter: Julien Lacour
>            Priority: Major
>         Attachments: fop.xconf, test.fo, tooltip.png
>
>
> If I enable encryption in my xconf, the alt text tooltip is scrambled in the 
> PDF:
> !tooltip.png!
> I've attached the files for reproduction, I've used FOP 2.11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to