You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Hesham Gneady <he...@gmail.com> on 2017/12/12 09:50:56 UTC

Understanding PDPageXYZDestination.setTop(...)

Hello ,

 

I am trying to use PDPageXYZDestination to create an internal link that
could move to a specific area in another page in the same PDF. Here is the
code I've tried:

 

List<PDAnnotation> annotations = page1.getAnnotations();

PDPageXYZDestination dest = new PDPageXYZDestination();

dest.setPage( page3 );

dest.setZoom( 3 );

dest.setLeft( 200 );

dest.setTop( 200 );  // Does nothing at any value!!

txtLink.setDestination(dest);

annotations.add( txtLink );

 

When opening the output PDF using Adobe Reader and clicking the link it
takes me to page 3, zooms in to 300% and moves the viewable area 200 points
in X direction, so dest.setLeft( 200 ) works just fine, but for the Y
direction it keeps showing the top rectangle of page 3 whatever value I try
to use for dest.setTop( . ).

 

Do you understand PDPageXYZDestination.setTop( . ) wrong, or there is a bug
with it?

 

 

Best regards,

Hesham 

 

 

 



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

RE: Understanding PDPageXYZDestination.setTop(...)

Posted by Hesham Gneady <he...@gmail.com>.
Tilman,

 

I have tried it now and it's working. I must have been doing something wrong.

Thanks a lot 😊

 

 

Best regards,

Hesham

 

--------------------------------------------------------------------------------------------------

Included Message:

 

I tried it with the AddAnnotations example. There is a difference between 100 and 500. You can see the difference by looking at the scroll bar.

 

Tilman

 

Am 12.12.2017 um 10:50 schrieb Hesham Gneady:

> Hello ,

> 

>   

> 

> I am trying to use PDPageXYZDestination to create an internal link 

> that could move to a specific area in another page in the same PDF. 

> Here is the code I've tried:

> 

>   

> 

> List<PDAnnotation> annotations = page1.getAnnotations();

> 

> PDPageXYZDestination dest = new PDPageXYZDestination();

> 

> dest.setPage( page3 );

> 

> dest.setZoom( 3 );

> 

> dest.setLeft( 200 );

> 

> dest.setTop( 200 );  // Does nothing at any value!!

> 

> txtLink.setDestination(dest);

> 

> annotations.add( txtLink );

> 

>   

> 

> When opening the output PDF using Adobe Reader and clicking the link 

> it takes me to page 3, zooms in to 300% and moves the viewable area 

> 200 points in X direction, so dest.setLeft( 200 ) works just fine, but 

> for the Y direction it keeps showing the top rectangle of page 3 

> whatever value I try to use for dest.setTop( . ).

> 

>   

> 

> Do you understand PDPageXYZDestination.setTop( . ) wrong, or there is 

> a bug with it?

> 

>   

> 

>   

> 

> Best regards,

> 

> Hesham

> 

>   

> 

>   

> 

>   

> 

> 

> 

> ---

> This email has been checked for viruses by Avast antivirus software.

>  <https://www.avast.com/antivirus> https://www.avast.com/antivirus

> 

 

 

---------------------------------------------------------------------

To unsubscribe, e-mail:  <ma...@pdfbox.apache.org> users-unsubscribe@pdfbox.apache.org

For additional commands, e-mail:  <ma...@pdfbox.apache.org> users-help@pdfbox.apache.org

 


Re: Understanding PDPageXYZDestination.setTop(...)

Posted by Tilman Hausherr <TH...@t-online.de>.
I tried it with the AddAnnotations example. There is a difference 
between 100 and 500. You can see the difference by looking at the scroll 
bar.

Tilman

Am 12.12.2017 um 10:50 schrieb Hesham Gneady:
> Hello ,
>
>   
>
> I am trying to use PDPageXYZDestination to create an internal link that
> could move to a specific area in another page in the same PDF. Here is the
> code I've tried:
>
>   
>
> List<PDAnnotation> annotations = page1.getAnnotations();
>
> PDPageXYZDestination dest = new PDPageXYZDestination();
>
> dest.setPage( page3 );
>
> dest.setZoom( 3 );
>
> dest.setLeft( 200 );
>
> dest.setTop( 200 );  // Does nothing at any value!!
>
> txtLink.setDestination(dest);
>
> annotations.add( txtLink );
>
>   
>
> When opening the output PDF using Adobe Reader and clicking the link it
> takes me to page 3, zooms in to 300% and moves the viewable area 200 points
> in X direction, so dest.setLeft( 200 ) works just fine, but for the Y
> direction it keeps showing the top rectangle of page 3 whatever value I try
> to use for dest.setTop( . ).
>
>   
>
> Do you understand PDPageXYZDestination.setTop( . ) wrong, or there is a bug
> with it?
>
>   
>
>   
>
> Best regards,
>
> Hesham
>
>   
>
>   
>
>   
>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org