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

Ronny Bartz edited comment on FOP-2279 at 7/30/13 7:59 AM:
-----------------------------------------------------------

Hi,

Just saw https://issues.apache.org/bugzilla/show_bug.cgi?id=41959 and played 
around with the described patch.

What worked for me:

org.apache.fop.pdf.PDFUri

A, added

protected byte[] encodeText2(String text) {
      if (getDocumentSafely().isEncryptionActive()) {
         final byte[] buf = PDFText.encode(text);
         byte[] enc = getDocument().getEncryption().encrypt(buf, this);
         return PDFText.toHex(enc, true).getBytes();
      }
      else {
         return encode(PDFText.escapeText(text, false));
      }
   }

B, changed 

private String getDictString() {
      return "<< /URI (" + uri + ")\n/S /URI >>";
   }

TO

private String getDictString() {
      String uriString = new String(this.encodeText2(uri));
      return "<< /URI " + uriString + "\n /S /URI >>";
   }


Would be good to have a final solution in an official release.

Thanks
Ronny
                
      was (Author: bartzr):
    Hi,

Just saw 'https://issues.apache.org/bugzilla/show_bug.cgi?id=41959' and played 
around with the described patch.

What worked for me:

org.apache.fop.pdf.PDFUri

A, added

protected byte[] encodeText2(String text) {
      if (getDocumentSafely().isEncryptionActive()) {
         final byte[] buf = PDFText.encode(text);
         byte[] enc = getDocument().getEncryption().encrypt(buf, this);
         return PDFText.toHex(enc, true).getBytes();
      }
      else {
         return encode(PDFText.escapeText(text, false));
      }
   }

B, changed 

private String getDictString() {
      return "<< /URI (" + uri + ")\n/S /URI >>";
   }

TO

private String getDictString() {
      String uriString = new String(this.encodeText2(uri));
      return "<< /URI " + uriString + "\n /S /URI >>";
   }


Would be good to have a final solution in an official release.

Thanks
Ronny
                  
> External fo links don't work in encrypted PDFs
> ----------------------------------------------
>
>                 Key: FOP-2279
>                 URL: https://issues.apache.org/jira/browse/FOP-2279
>             Project: Fop
>          Issue Type: Bug
>          Components: pdf
>    Affects Versions: 1.1, trunk
>            Reporter: Matthias Reischenbacher
>         Attachments: pdf_encrypted_with_external_link.fo, 
> pdf_encrypted_with_external_link.pdf, pdf_with_external_link.pdf
>
>
> When generating an encrypted PDF (e.g. with "-noprint" option via cli) 
> external fo:basic-link elements don't work anymore.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to