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: About Link Annotations
Date Thu, 16 May 2019 11:43:25 GMT
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 Евгений Король <fffars6@gmail.com> wrote:

> Version 2.0.13
>
> чт, 16 мая 2019 г. в 16:28, Gilad Denneboom <gilad.denneboom@gmail.com>:
> >
> > Let's take a step back. What version of PDFBox are you using?
> >
> > On Thu, May 16, 2019 at 12:17 PM Евгений Король <fffars6@gmail.com>
> wrote:
> >
> > > Or maybe how to get PDAnnotationLink from page?
> > >
> > > чт, 16 мая 2019 г. в 15:10, Евгений Король <fffars6@gmail.com>:
> > > >
> > > > I I have not found method getDestination. What objects have this
> methods?
> > > >
> > > > чт, 16 мая 2019 г. в 15:07, Gilad Denneboom <
> gilad.denneboom@gmail.com>:
> > > > >
> > > > > 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 Евгений Король <fffars6@gmail.com
> >
> > > 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: users-unsubscribe@pdfbox.apache.org
> > > > > > For additional commands, e-mail: users-help@pdfbox.apache.org
> > > > > >
> > > > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> > > For additional commands, e-mail: users-help@pdfbox.apache.org
> > >
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

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