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

Gilad Denneboom edited comment on PDFBOX-5470 at 7/3/22 12:07 PM:
------------------------------------------------------------------

Thanks a lot, Tilman! I updated the jar file in my project, and it's indeed not 
throwing an Exception any longer, but the link still doesn't work. I compared 
the A dictionary of a link created in Acrobat with that created using PDFBox (I 
used the PDF Debugger) and am not seeing any differences that would explain why 
this is happening.

I attached the output created by the code, and the same file edited by Acrobat. 
 Any insight would be welcome!

 

PS. I added the following line to the code, just in case:

dest.setTop(0);


was (Author: giladd):
Thanks a lot, Tilman! I updated the jar file in my project, and it's indeed not 
throwing an Exception any longer, but the link still doesn't work. I compared 
the A dictionary of a link created in Acrobat with that created using PDFBox (I 
used the PDF Debugger) and am not seeing any differences that would explain why 
this is happening.

I attached the output created by the code, and the same file edited by Acrobat. 
 Any insight would be welcome!

> PDActionEmbeddedGoTo does not accept a Destination with a page number or 
> string
> -------------------------------------------------------------------------------
>
>                 Key: PDFBOX-5470
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5470
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 2.0.26
>            Reporter: Gilad Denneboom
>            Assignee: Tilman Hausherr
>            Priority: Minor
>             Fix For: 2.0.27, 3.0.0 PDFBox
>
>         Attachments: EmbeddedActionTest-1.java, LinkTest.pdf, 
> LinkTest_Acrobat.pdf, LinkTest_edited.pdf, StackTrace.txt
>
>
> According to Table 202 of the PDF 32000-1:2008 specs, the P key under the 
> Target Directory of an Embedded Go-To Action is an "integer or byte string", 
> with the following description "If the value is an integer, it specifies the 
> page number (zero-based) in the current document containing the file 
> attachment annotation. If the value is a string, it specifies a named 
> destination in the current document that provides the page number of the file 
> attachment annotation."
> However, the current implementation of PDActionEmbeddedGoTo does not accept 
> using the setPageNumber command by itself when setting the Destination 
> dictionary, and throws an IllegalArgumentException unless setPage is used to 
> set the target page as a PDPage object, which is not specified in the 
> documentation. Also, there doesn't seem to be a way to specify the target as 
> a string, if a named destination is to be used.
> This applies to both the Destination dictionary and the Target Directory, but 
> when creating such a link in Acrobat the Target Directory does not contain a 
> P value at all, only the Destination dictionary does, and in the form of a 
> number. This should be possible to replicate using PDFBox.
>  
> Attached are a sample file with a pre-existing link and a PDF attachment, the 
> code trying to set that link's action to open the attachment on page 3, and 
> the resulting error message stack trace.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to