Xamarin Link Annotations not clickable

Hello,

I am using Pdf-tron in a UWP-application with C# using Xamarin. I am having trouble getting link annotations (goto page & url links) working.

I have been looking through this forum for similar issues that might help me achieve a solution. I discovered this post but the solution given did not work on my end.

This feature did work in my code before, but not sure what could have caused it to fail now. I have tried creating a new PDFToolManager and ViewerManager with default PDFViewCtrl, but still no luck.

Any assistance with my issues would be greatly appreciated.

Thanks,
-Dante

Hello Dante,

Thank you for reaching out to us

If you are using our PDFTron’s UWP SDK you can refer to the simple C# code snippet below to create a hyperlink and GoTo page.

I’ve also tested it in our Xamarin UWP sample project and it works as expected.

You can refer to the Sample Project here: https://github.com/PDFTron/xamarin-forms-sample/tree/master/ContentPage

var doc = PDFViewCtrl.GetDoc();

// Create a hyperlink...
Page first_page = doc.GetPage(1);
Link hyperlink = Link.Create(doc.GetSDFDoc(), new Rect(85, 570, 503, 524), pdftron.PDF.Action.CreateURI(doc.GetSDFDoc(), "http://www.pdftron.com"));
first_page.AnnotPushBack(hyperlink);
hyperlink.RefreshAppearance();

// Create an intra-document link / GoTo
pdftron.PDF.Action goto_page_3 = pdftron.PDF.Action.CreateGoto(Destination.CreateFitH(doc.GetPage(3), 0));
Link link = Link.Create(doc.GetSDFDoc(), new Rect(85, 458, 503, 502), goto_page_3);
link.SetColor(new ColorPt(0, 0, 1));
           
// Add the new annotation to the first page
first_page.AnnotPushBack(link);
link.RefreshAppearance();

 PDFViewCtrl.Update();

Please let me know if it helps you

Hello,

I was able to fix this issue on my end. The issue was created on my end becuase of the way I was loading and applying my annotations.

Thank you for the quick response,
-Dante

Hello Dante,

I’m glad you sorted it out.
Don’t hesitate to contact us if you need any extra help

Regards,
Robson