You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Gilad Denneboom <gi...@gmail.com> on 2013/01/14 23:40:35 UTC
Specify Named Destination with PDActionLaunch
Hi all,
I'm looking for a way to create a link that uses opens a PDF at a specific
Named Destination (a bit like the cDest parameter of app.openDoc() in JS),
and I was thinking that maybe one of the parameters of PDActionLaunch can
do it, but I haven't been able to find out if that's the case or not.
Any help is appreciated...
Gilad
Re: Specify Named Destination with PDActionLaunch
Posted by Gilad Denneboom <gi...@gmail.com>.
I was asked by a fellow-user to explain how I did it, so here goes (assume
you have two strings, one called remoteFilePath with the path of the file,
and one called remoteDestName with the name of the Named Destination you
wish to open):
PDAction action = new PDActionRemoteGoTo();
PDSimpleFileSpecification fileSpec = new
PDSimpleFileSpecification();
fileSpec.setFile(remoteFilePath);
((PDActionRemoteGoTo) action).setFile(fileSpec);
((PDActionRemoteGoTo) action).setD(new
COSString(remoteDestName));
And a bit later on we apply the action to the PDAnnotationLink object, and
add that object to the PDPage:
txtLink.setAction(action);
page.getAnnotations().add(txtLink);
Hope this helps!
On Tue, Jan 15, 2013 at 12:02 AM, Gilad Denneboom <gilad.denneboom@gmail.com
> wrote:
> I just realized I can use PDActionRemoteGoTo... Silly me...
>
>
> On Mon, Jan 14, 2013 at 11:40 PM, Gilad Denneboom <
> gilad.denneboom@gmail.com> wrote:
>
>> Hi all,
>>
>> I'm looking for a way to create a link that uses opens a PDF at a
>> specific Named Destination (a bit like the cDest parameter of app.openDoc()
>> in JS), and I was thinking that maybe one of the parameters of
>> PDActionLaunch can do it, but I haven't been able to find out if that's the
>> case or not.
>>
>> Any help is appreciated...
>>
>> Gilad
>>
>
>
Re: Specify Named Destination with PDActionLaunch
Posted by Gilad Denneboom <gi...@gmail.com>.
I just realized I can use PDActionRemoteGoTo... Silly me...
On Mon, Jan 14, 2013 at 11:40 PM, Gilad Denneboom <gilad.denneboom@gmail.com
> wrote:
> Hi all,
>
> I'm looking for a way to create a link that uses opens a PDF at a specific
> Named Destination (a bit like the cDest parameter of app.openDoc() in JS),
> and I was thinking that maybe one of the parameters of PDActionLaunch can
> do it, but I haven't been able to find out if that's the case or not.
>
> Any help is appreciated...
>
> Gilad
>