Custom trigger to hyperlinks / link and goto that are already created in original PDF

PDF.js Express Version

Detailed description of issue
Hi, I am trying to display PDF documents that have external hyperlinks to files. First I need how to Active those links to work.
Second, I need somehow to catch the event when the user click the external hyperlink and try to redirect it to existing file in the server.

I try this link for PDFTRON but it don’t work.

Expected behaviour
{Provide a screenshot or description of the expected behaviour}
First, When the user click on the hyperlink, open a blank page with the link

Does your issue happen with every document, or just one?
{Answer here}

Link to document
{Provide a link to the document in question if possible}

Code snippet
{Provide a relevant code snippet}

Hey there! Thanks for trying out PDF.js Express.

You’re super close. For external links, you’ll actually want to override the URI Action instead of GoToR.

WebViewer(...).then(instance => {
  const uriTrigger = Actions.URI.prototype.onTriggered;
  Actions.URI.prototype.onTriggered = function(link) {
    //uriTrigger.apply(this, arguments); // uncomment this to use default functionality

With the URI you can do whatever you wish.

Let me know if theres anything else I can help with.


Hi Logan, thank you for your answer.

I managed to do trigger my custom event with the PdfTron demo. How ever , I didn´t have success with the PDF.js Express demo.

In Pdf.js Express the annotations are not returning actions.

This is my code

path: ‘PDFJSExpress/lib’, // path to the PDF.js Express’lib’ folder on your server
licenseKey: ‘Insert commercial license key here after purchase’,
initialDoc: ‘WebViewer/samples/viewing/viewing/ejemplo3/test.pdf’,

    }, document.getElementById('viewer'))

        .then(instance => {
            const docViewer = instance.docViewer;
            const annotManager = instance.annotManager;
         //PDFTron return actions but PDF.JSExpress don't   
         docViewer.on('annotationsLoaded', () => {
                const annotations = annotManager.getAnnotationsList();
                annotations.forEach(annot => {
                    var a = annot.getActions();
                    if (a.U) {
                        if (a.U.length>0) {
                            var act = a.U[0];
                            if (act.elementName == 'URI') {
                                var auri =;
                                act.onTriggered = function (dispacher, event, owner) {
                                    //Do something


Please note that you cannot rely on the minified properties such as a.U and, as these may change between versions/builds.

Is the issue that annot.getActions(); returns an empty array using Express?

Thank you Logan, I will fix the code to not use the minifield properties.

Yes , in Express annot.getActions() returns an empty array