Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

Open Hyperlink URI onTouch 9 years 8 months ago #6840

  • ahmad.kayyali
  • ahmad.kayyali's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
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.

Please Log in or Create an account to join the conversation.

Open Hyperlink URI onTouch 9 years 8 months ago #6843

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
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]);

Please Log in or Create an account to join the conversation.

Open Hyperlink URI onTouch 9 years 8 months ago #6856

  • ahmad.kayyali
  • ahmad.kayyali's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
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.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum