Xamarin Link Annotations not clickable

29 views
Skip to first unread message

Dante DeSantis

unread,
Mar 23, 2021, 11:05:24 AM3/23/21
to PDFTron WebViewer
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


Robson Pontin

unread,
Mar 24, 2021, 2:41:45 PM3/24/21
to pdfnet-w...@googlegroups.com, pdfnet-w...@googlegroups.com
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.

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
Thank you

Robson Pontin
Windows UI Developer | PDFTron Systems, Inc.




, PDFTron WebViewer Forum <pdfnet-w...@googlegroups.com> wrote:
--
You received this message because you are subscribed to the Google Groups "PDFTron WebViewer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfnet-webview...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pdfnet-webviewer/6ed0142e-ea1b-4e8b-99b9-0ce7eb950c0bn%40googlegroups.com.
20933:789536

Dante DeSantis

unread,
Mar 24, 2021, 3:26:59 PM3/24/21
to PDFTron WebViewer
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

Robson Pontin

unread,
Mar 24, 2021, 3:40:31 PM3/24/21
to pdfnet-w...@googlegroups.com, pdfnet-w...@googlegroups.com
Hello Dante,

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

Regards,
Robson


, PDFTron WebViewer Forum <pdfnet-w...@googlegroups.com> wrote:
Reply all
Reply to author
Forward
0 new messages