Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

Open Hyperlink URI onTouch

More
IP: 192.168.0.71 12 years 1 month ago #6840 by ahmad.kayyali
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:
Code:
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.
More
IP: 192.168.0.71 12 years 1 month ago #6843 by radaee
Replied by radaee on topic Open Hyperlink URI onTouch
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]);
More
IP: 192.168.0.71 12 years 1 month ago #6856 by ahmad.kayyali
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.
Time to create page: 0.468 seconds
Powered by Kunena Forum