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: Error encountered : Destination of a GoTo action must be a page dictionary object
Date Wed, 07 Oct 2015 09:00:01 GMT
Try using setPage instead of setPageNumber. It's a better approach because
if you then swap pages around your bookmarks will automatically update,
unlike with setPageNumber.

On Wed, Oct 7, 2015 at 9:36 AM, Nick Brockett <NBrockett@datasys.co.uk>
wrote:

> Hi
> Please can someone help explain the above error?
> I am using
>        <dependency>
>               <groupId>org.apache.pdfbox</groupId>
>               <artifactId>pdfbox</artifactId>
>               <version>1.8.10</version>
>        </dependency>
> I am creating a report using PDFBox.
> My report  is a master-detail style layout.
> First few pages present a table of records, followed by a minimum of one
> single page for each entry.
> So 20 rows in the first page will be followed by at least 20 pages of
> separate detail pages.
> Each record (row) in the master table then needs a hyperlink to GoTo the
> relevant page.
>
> My design requires that the first column in the master table has its Text
> value working as a hyperlink.
>
> My attempts with the following code structure (which for now simply tries
> to place a rectangle at the bottom of each page is giving me the error in
> the title of this email.
> Once this is achieved I can then move to place each page Link behind the
> first cell.
>                       //set a pageLink
>                   PDAnnotationLink goToLink         = new
> PDAnnotationLink();
>                   PDPageDestination destination = new
> PDPageFitWidthDestination();
>                   PDActionGoTo goToAction           = new PDActionGoTo();
>                   destination.setPageNumber(1);
>                   goToAction.setDestination(destination);
>                   goToLink.setAction(goToAction);
>                    PDRectangle pos = new PDRectangle();
>                   pos.setLowerLeftX(150);
>                   pos.setLowerLeftY(20);
>                    pos.setUpperRightX(200);
>                    pos.setUpperRightY(10);
>                    goToLink.setRectangle(pos);
>                    page.getAnnotations().add(goToLink);
>
>
>
> Help greatly appreciated!!
> Thanks
> Nick
>
>

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