pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilad Denneboom <gilad.denneb...@gmail.com>
Subject Re: Specify Named Destination with PDActionLaunch
Date Tue, 15 Jan 2013 09:15:01 GMT
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
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message