is there a way to trigger actions from code?

I am using the InterceptAnnotationHandling functionality to extract the Link annotation to handle GoTo_R links

When I open the document that is being linked to can I manually create a Goto link and execute it?

_pdfDoc = new PDFDoc(FilePath);
Destination dest = Destination.CreateFitR( page, l, b, r, t);
var pageView = pdftron.PDF.Action.CreateGoto(dest);


// Execute pageView action ???



Could you confirm which platform you are asking about. Is it UWP?

Can you also elaborate on exactly what API you are referring to with InterceptAnnotationHandling?

Hi Ryan,

We are using Xamarin so implementation will need to be on IOS, Android and UWP

InterceptAnnotationHandling is part of the PDFTron ToolManager

Flow is

Client Opens a PDF
Clicks Link
Intercept Link and process to determine which document they want
Open or download and open document

What I need to be able to do is if there is a destination set as part of the link in the original document, I need to got that part of the document.


Sorry for the delay in a reply.

A link annotation can be created like this:

Action goto_page_3 = Action.createGoto(Destination.createFitH(doc.getPage(3), 0)); com.pdftron.pdf.annots.Link link = com.pdftron.pdf.annots.Link.create(doc.getSDFDoc(), new Rect(85, 458, 503, 502), goto_page_3); first_page.annotPushBack(link);

When interacting with the link:

Action a = link.getAction(); ActionParameter action_param = new ActionParameter(a); pdfViewCtrl.executeAction(actionParam);

If this is not what you are looking for, can you please elaborate in details exactly what you are trying to achieve so we can better assist.

Thanks Ryan, that is what I am looking for,

What is the way to do this in Xamarin for IOS

the PDFViewCtrl ExecuteAction or ExecuteActionWithActionParameter functions both use PT implemetations of Action or ActionParameter is there a way to convert from and Action or ActionParameter to the PT version of these or create these PTAction / PTActionParameters?


Yes, you would want to use method:



Please let us know how it works for you. Thanks.

Hi Ryan,

While it works on IOS I am getting an error on Android (pdfron.Android 6.9.0)

{Java.Lang.NullPointerException: Attempt to invoke virtual method ‘com.pdftron.sdf.Obj com.pdftron.pdf.Action.getSDFObj()’ on a null object reference
at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <0ad2222fd7074badb5de547b1521aab0>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in <0ad2222fd7074badb5de547b1521aab0>:0
at pdftronprivate.PDF.PDFViewCtrl.ExecuteAction (pdftronprivate.PDF.ActionParameter p0) [0x00031] in <30b392ec98784c849d0cf1c9b6544d46>:0
at pdftron.PDF.PDFViewCtrl.ExecuteAction (pdftron.PDF.ActionParameter actionParam) [0x00007] in <30b392ec98784c849d0cf1c9b6544d46>:0
at Field.Mobile.Droid.Renderers.PdfViewerRenderer.ExecuteAction (pdftron.PDF.Action action) [0x00009] in C:\Work\FieldMobileApp\App\Field.Mobile\Field.Mobile.Droid\Renderers\PdfViewerRenderer.cs:608
— End of managed Java.Lang.NullPointerException stack trace —
java.lang.NullPointerException: Attempt to invoke virtual method ‘com.pdftron.sdf.Obj com.pdftron.pdf.Action.getSDFObj()’ on a null object reference
at com.pdftron.pdf.PDFViewCtrl.executeAction(SourceFile:8111)
at Method)
at android.os.Handler.handleCallback(
at android.os.Handler.dispatchMessage(
at android.os.Looper.loop(
at java.lang.reflect.Method.invoke(Native Method)

using the following code

// INFO - (linkedDestination.PageNumber = 1)


private void ExecuteAction(pdftron.PDF.Action action)
ActionParameter a_p = new ActionParameter(action);
catch (Exception ex)
throw ex;

Any ideas?




This means the Action you passed in is not valid.

Can you please do:

if (action != null && action.IsValid())



This made no difference the action is returning as valid,



Would it be possible if you could share us the file you are testing with and a complete code snippet so we can reproduce it on our side?
Thank you!

Best Regards.