Ok. When i get Destination, i have class PDPageXYZDestination. And
then try to get getPageNumber. But i got -1. Because "A page
destination can either reference a page (for a local destination) or a
page number (when doing a remote destination to another PDF)". But if
link referenve a local destination i got page. And how i can know
number of this page in my document? If it in another PDF i can get
number but not it in local document.

чт, 16 мая 2019 г. в 16:43, Gilad Denneboom <[email protected]>:
>
> That's OK, although you can update to 2.0.15.
> Anyway, each PDPage object has a getAnnotations method which returns a List
> of all the PDAnnotation objects on that page.
> You can iterate over that list, looking for items which are of the class
> PDAnnotationLink. Those are the links.
> If you cast these items to PDAnnotationLink you'll see that they all have a
> getAction and getDestination method.
> According to the documentation only one of those two should be set, so you
> need to figure out which one.
> If it's an Action you need to find what class it is, and if it's something
> like PDActionGoTo it will also have a Destination, which you can access
> using getDestination.
> Once you have the destination you find out which class it is. If it's
> something like PDPageDestination then you can use getPageNumber or getPage
> to find the page it is linking to.
>
> On Thu, May 16, 2019 at 1:31 PM Евгений Король <[email protected]> wrote:
>
> > Version 2.0.13
> >
> > чт, 16 мая 2019 г. в 16:28, Gilad Denneboom <[email protected]>:
> > >
> > > Let's take a step back. What version of PDFBox are you using?
> > >
> > > On Thu, May 16, 2019 at 12:17 PM Евгений Король <[email protected]>
> > wrote:
> > >
> > > > Or maybe how to get PDAnnotationLink from page?
> > > >
> > > > чт, 16 мая 2019 г. в 15:10, Евгений Король <[email protected]>:
> > > > >
> > > > > I I have not found method getDestination. What objects have this
> > methods?
> > > > >
> > > > > чт, 16 мая 2019 г. в 15:07, Gilad Denneboom <
> > [email protected]>:
> > > > > >
> > > > > > You don't need to access the COS object directly. The link object
> > can
> > > > have
> > > > > > either an Action or a Destination which jumps to another page.
> > > > > > So you can access getAction and if it's null access getDestination
> > and
> > > > then
> > > > > > parse it further to see what kind of PDDestinationOrAction object
> > it
> > > > > > returns, and what it does.
> > > > > >
> > > > > > On Thu, May 16, 2019 at 11:40 AM Евгений Король <[email protected]
> > >
> > > > wrote:
> > > > > >
> > > > > > > Hello. I try to get information from Link Annotation of pdf
> > file. How
> > > > > > > do I know which page link links to? I tried get getCOSObject from
> > > > > > > annotation and parse it for Dest to get page. Perhaps this can be
> > > > done
> > > > > > > easier?
> > > > > > >
> > > > > > >
> > ---------------------------------------------------------------------
> > > > > > > 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]
> >
> >

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

Reply via email to