Hi,

> Am 26.04.2016 um 11:12 schrieb Jana Sefcikova <[email protected]>:
> 
> Hi Maruan,
> 
> thank you for your response.
> 
> Where this code can be placed ? Somewhere in GUI or it can be done
> programatically ?

I havnÄt had the time to test the code but that should work I think:

you can add Javascript to an annotation like this for a given annotation 'annot'

PDActionJavaScript javascriptAction = new 
PDActionJavaScript("app.launchURL("http://yoururl";, true);");
PDAnnotationAdditionalActions actions = new PDAnnotationAdditionalActions();
actions.setU(javascriptAction);
annot.setActions(actions);

> What is app ?

app is an Adobe Acrobat/Reader JavaScript object representing the application 
the PDF is running in (Acrobat/Reader). This is part of the Acrobat JavaScript 
SDK http://www.adobe.com/devnet/acrobat/javascript.html

Let me know if you are experiencing any issues.

BR
Maruan



> 
> Thank you
> 
> ps: I am first time replying to this mailing list, and I am not sure
> whether this answer will be correctly placed under original discussion, as
> I don't know who should be recipient
> 
> 
> On Sat, Apr 23, 2016 at 6:55 PM, Maruan Sahyoun <[email protected]>
> wrote:
> 
>> Hi,
>> 
>>> Am 23.04.2016 um 19:47 schrieb Tilman Hausherr <[email protected]>:
>>> 
>>> Hi,
>>> 
>>> If you download this PDF
>>> 
>> https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf
>>> open it, then go to the second page, and click on the link, what happens?
>>> 
>>> (I suspect this is rather a problem of the browser or an Adobe Reader
>> setting)
>>> 
>>> Tilman
>>> 
>>> Am 23.04.2016 um 13:27 schrieb Jana Sefcikova:
>>>> Hi, I am using pdfbox to create links inside pdf as follows:
>>>> 
>>>> PDAnnotationLink txtLink = new PDAnnotationLink();
>>>> 
>>>> // code for setting position
>>>> 
>>>> PDActionURI action = new PDActionURI();
>>>> 
>>>> action.setURI("http://www.google.com";);
>>>> 
>>>> txtLink.setAction(action);
>> 
>> 
>> a regular link annotation doesn't have the capability. What you can do is
>> adding a JavaScript with the following content
>> 
>> app.launchURL("http://yoururl";, true);
>> 
>> replacing <yoururl> with the actual one.
>> 
>> Be aware that this JavaScript is application specific so might not work in
>> Readers other than Adobe Reader / Acrobat.
>> 
>> BR
>> Maruan
>> 
>> 
>>>> 
>>>> But when I open pdf in browser and click on the annotated text, it opens
>>>> url in the current tab in the browser.
>>>> 
>>>> 
>>>> Can I open links in new tab using pdfbox ? If yes, could you provide
>> some
>>>> example ?
>>>> 
>>>> Thank you very much
>>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
>> 
> On Sat, Apr 23, 2016 at 6:55 PM, Maruan Sahyoun <[email protected]>
> wrote:
> 
>> Hi,
>> 
>>> Am 23.04.2016 um 19:47 schrieb Tilman Hausherr <[email protected]>:
>>> 
>>> Hi,
>>> 
>>> If you download this PDF
>>> 
>> https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf
>>> open it, then go to the second page, and click on the link, what happens?
>>> 
>>> (I suspect this is rather a problem of the browser or an Adobe Reader
>> setting)
>>> 
>>> Tilman
>>> 
>>> Am 23.04.2016 um 13:27 schrieb Jana Sefcikova:
>>>> Hi, I am using pdfbox to create links inside pdf as follows:
>>>> 
>>>> PDAnnotationLink txtLink = new PDAnnotationLink();
>>>> 
>>>> // code for setting position
>>>> 
>>>> PDActionURI action = new PDActionURI();
>>>> 
>>>> action.setURI("http://www.google.com";);
>>>> 
>>>> txtLink.setAction(action);
>> 
>> 
>> a regular link annotation doesn't have the capability. What you can do is
>> adding a JavaScript with the following content
>> 
>> app.launchURL("http://yoururl";, true);
>> 
>> replacing <yoururl> with the actual one.
>> 
>> Be aware that this JavaScript is application specific so might not work in
>> Readers other than Adobe Reader / Acrobat.
>> 
>> BR
>> Maruan
>> 
>> 
>>>> 
>>>> But when I open pdf in browser and click on the annotated text, it opens
>>>> url in the current tab in the browser.
>>>> 
>>>> 
>>>> Can I open links in new tab using pdfbox ? If yes, could you provide
>> some
>>>> example ?
>>>> 
>>>> Thank you very much
>>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
>> 


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

Reply via email to