RadaeePDF.com :: Topic: Open Hyperlink URI onTouch (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: Open Hyperlink URI onTouch

Open Hyperlink URI onTouch 2 years 11 months ago #6840

I am using RenderToBmp(...); to display my PDF pages, in other hand I would like to support hyperlinks my application, I came to Page.Annotation class which do exactly what I need.

What I want to achieve here is to open the URI of the hyperlink as soon as the user touch the hyperlink using getAnnotFromPoint(x,y) but what I could not achieve is to map the device X & Y coordinates touched by the user to the actual PDF point.

I tried the following:
float[] dpoint = new float[2];
float[] ppoint = new float[2];
dpoint[0] = x; x coordinate the user touched 
dpoint[1] = y; y coordinate the user touched 

// 1.4521009 : is the scale that I used to render the bitmap to view the actual page.
// 1222.0    : is the actual PDF height  

Matrix matrix = new Matrix(1.4521009f, -1.4521009f, 0, 1222.0f);
Global.ToPDFPoint(matrix, dpoint, ppoint);

Annotation annotation = pdfPage.GetAnnotFromPoint(ppoint[0], ppoint[1]);

but annotation object is always null, any help of guide would be greatly appreciated.
The administrator has disabled public write access.

Open Hyperlink URI onTouch 2 years 11 months ago #6843

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
float[] dpoint = new float[2];
float[] ppoint = new float[2];
dpoint[0] = x - bmp_x;//x is touched point, bmp_x is bitmap where displayed.
dpoint[1] = y - bmp_y;//y is touched point, bmp_y is bitmap where displayed.
// 1.4521009 : is the scale that I used to render the bitmap to view the actual page.
// 1222.0 : is the actual PDF height
Matrix matrix = new Matrix(1.4521009f, -1.4521009f, 0, 1222.0f);
Global.ToPDFPoint(matrix, dpoint, ppoint);
Annotation annotation = pdfPage.GetAnnotFromPoint(ppoint[0], ppoint[1]);
The administrator has disabled public write access.
The following user(s) said Thank You: masp

Open Hyperlink URI onTouch 2 years 11 months ago #6856

Thank you for your response,

I am viewing my PDF pages in a ViewPager which means each PDF page is displayed individually then my case bmp_x and bmp_y will be always 0 am I correct? please let me know if I am missing your point.
The administrator has disabled public write access.
Powered by Kunena Forum