pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: question on getting location of bookmark
Date Thu, 01 Dec 2016 20:49:01 GMT
Am 01.12.2016 um 21:38 schrieb howardg@tlcc.com:
> thanks, I am missing something... My code uses getDestination() and
> recasts as PDPageXYZDestination. However, the dest is null. I must be
> missing something?

There's anther possibilty, that there is an /A entry, i.e. an action. 
Call getAction(). There are 13 different types of actions, but I'd 
expect PDActionGoTo. On that one you can again call getDestination().

Tilman


>
>    PDDocumentOutline outline = pdfDoc
> .getDocumentCatalog().getDocumentOutline();
>                              if( outline != null ){
>                                  debugMsg2("found outline");
>                                  PDOutlineItem current =
> outline.getFirstChild();
>                                  while( current != null ) {
>                                          debugMsg2(  current.getTitle() );
>                                          if ("Image"
> .equalsIgnoreCase(current.getTitle())){
>                                                  PDPageXYZDestination dest
> = (PDPageXYZDestination) current.getDestination();
>                                                  if (dest!=null){
>                                                          debugMsg2("left: "
> + dest.getLeft());
>                                                          debugMsg2("top: "
> + dest.getTop());
>                                                          debugMsg2("page: "
> + dest.getPageNumber());
>                                                  } else {
>                                                          debugMsg2("dest is
> null");
>                                                  }
>                                          }
>                                          current =
> current.getNextSibling();
>                                  }
>   
>   
>                              } else {
>                                  debugMsg2( "This document does not contain
> any bookmarks" );
>                              }
>   
>
> Howard
> Howard Greenberg, CPA, CISA
> IBM Certified Application Developer/Instructor - IBM Notes and Domino
> The Learning Continuum Company, Ltd.
> 888-241-8522 or 561-953-0096
> http://www.tlcc.com
> mailto:howardg@tlcc.com
>
>
>
> From:   Tilman Hausherr <THausherr@t-online.de>
> To:     users@pdfbox.apache.org
> Date:   12/01/2016 03:15 PM
> Subject:        Re: question on getting location of bookmark
>
>
>
> Am 01.12.2016 um 21:12 schrieb howardg@tlcc.com:
>> thanks, can you elaborate? The API doc for getDestination shows that
>> returns PDDestination and I don't see any methods that return the
>> coordinates?
> There are 7 derived classes. That's why I mentioned that there are
> several types. For example, PDPageXYZDestination has a getLeft() and
> getTop() method. But not all of the derived classes have coordinates
> like that.
>
> Tilman
>
>>
>>
>> Howard
>> Howard Greenberg, CPA, CISA
>> IBM Certified Application Developer/Instructor - IBM Notes and Domino
>> The Learning Continuum Company, Ltd.
>> 888-241-8522 or 561-953-0096
>> http://www.tlcc.com
>> mailto:howardg@tlcc.com
>>
>>
>>
>> From:   Tilman Hausherr <THausherr@t-online.de>
>> To:     users@pdfbox.apache.org
>> Date:   12/01/2016 03:03 PM
>> Subject:        Re: question on getting location of bookmark
>>
>>
>>
>> Am 01.12.2016 um 21:00 schrieb howardg@tlcc.com:
>>> I want to find the x,y position of a bookmark in the pdf to be able to
>>> insert an image at that location.
>>>
>>> I can get the bookmark with the code below and looping through to find
>> the
>>> one I need with getTitle....
>>> PDOutlineItem current = outline.getFirstChild();
>>>
>>> But, how would I use PDOutlineItem to get the page/location to pass as
>> the
>>> x,y coordinates in contentStream.drawImage(img, 100, 100);
>> call getDestnation(). There are several types, and some of them have
>> coordinates.
>>
>> ---------------------------------------------------------------------
>> 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
View raw message