Re: Web viewer document links not working

119 views
Skip to first unread message

Gloogle Inc

unread,
Oct 20, 2016, 1:22:10 PM10/20/16
to PDFTron WebViewer on behalf of Ryan - PDFNet Developer
This is what the config files contains:

ReaderControl.config = {serverURL : '/Api/Document/Annotations/',
defaultUser: 'User name'};
ReaderControl.config.ui = {hidePrint : false,
showBookmarksPane : false,
hideTextSelect : false,
notebookEnabled : true,
allowDownload : false,
openForPrint : false,
docTypeSupportsAnnotations : false,
hideSidePanel : false,
hideDisplayModes : false,
hideZoom : false,
hideAnnotationPanel : false,
hideTextSearch : false};


Not sure if this itself can cause the problem somehow or the use f the `config` parameter is enough...
I will test...


2016-10-20 14:04 GMT+03:00 Gloogle Inc <kouko...@gmail.com>:
Hello.

We are using the PdfTron WebViewer (version 2.2.0) and we have noticed that when we specify a `config` url, links on the viewed document are not click-able, while when we don't specify the `config` parameter the links function normally.
Code example:

function initViewer(docId) {
    var viewerElement = document.getElementById('viewer');
    var url = '/Api/Document/?fileId=' + docId;
    var enableAnnotations = Boolean(docData.Settings.AllowAnnotations);     var myWebViewer = new PDFTron.WebViewer({         enableAnnotations: enableAnnotations,         enableReadOnlyMode: Boolean(docData.Settings.ReadonlyMode),         annotAvailable: Boolean(docData.Settings.AllowAnnotations),         type: 'html5',         initialDoc: url,         documentId: docId,
        path: '/Scripts/PdfTron_2.2.0/',         config: '/Api/Document/Configuration/?dt=' + docId, // <--------- This line causes the document links to become non-clickable when it is present.
        html5MobileOptions: {
            enableAnnotations: enableAnnotations
        }
    }, viewerElement);
}

Can you please let us know :

1) if this is a bug or if we are missing something here?
2) Are there any known workarounds for this?

Thank you! :)

Gloogle Inc

unread,
Oct 20, 2016, 1:22:10 PM10/20/16
to PDFTron WebViewer on behalf of Ryan - PDFNet Developer

Gloogle Inc

unread,
Oct 21, 2016, 1:19:11 PM10/21/16
to PDFTron WebViewer on behalf of Ryan - PDFNet Developer
Setting the same parameter when constructing the viewer results in the same problem:

var myWebViewer = new PDFTron.WebViewer({
    enableAnnotations: enableAnnotations,
    hideAnnotationPanel: !enableAnnotations,
    enableReadOnlyMode: Boolean(docData.Settings.ReadonlyMode),
    type: "html5",
    initialDoc: url,
    documentId: docData.DocId,
    path: "/Scripts/PdfTron_2.2.0/",
    config: "/Api/Document/Configuration/?dt=" + docData.DocId,
    serverUrl: 'http://localhost:2014/PDF/Editor/Annotations/',    <--------------------

    html5MobileOptions: {
        enableAnnotations: enableAnnotations
    }
}, viewerElement);

I wonder though, why the links work on your showcase when uploading the same document and not in our solution...
I have tried undoing all your viewer customizations and still nothing seem to fix this.

2016-10-21 13:53 GMT+03:00 Gloogle Inc <kouko...@gmail.com>:
After some testing, it seems that this line in the JSON above causes the problem:

     serverURL : '/Api/Document/Annotations/?id=123',

Still not sure why... :^)

Gloogle Inc

unread,
Oct 21, 2016, 1:19:12 PM10/21/16
to PDFTron WebViewer on behalf of Ryan - PDFNet Developer
After some testing, it seems that this line in the JSON above causes the problem:

     serverURL : '/Api/Document/Annotations/?id=123',

Still not sure why... :^)

Matt Parizeau

unread,
Oct 21, 2016, 2:58:13 PM10/21/16
to PDFTron WebViewer
Hi,

Would you be able to send a sample project that can reproduce the problem? Alternatively can you send us a link to your website so we can try to debug the problem there.

Just to confirm, you aren't able to reproduce the problems in an uncustomized WebViewer without a serverURL or config file?

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Gloogle Inc

unread,
Nov 1, 2016, 1:02:58 PM11/1/16
to PDFTron WebViewer
Hello.
Maybe I can create a sample project.
Hopefully I will manage to reproduce it there.

My instinct says that maybe it is something in the annotations XML (that we generate) that the viewer doesn't like.
We generate the XML on the fly.
The viewer shows the annotations, but maybe it doesn't like some aspects of the XML.
E.g. we send the annotations with some things missing:

<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
<annots>
<text page="0" color="#FFFF00" rect="523.607,628.149,546.857,651.399" width="0" opacity="1" icon="Comment" name="AnnotId-1841627" title="Kostas Ko..." date="D:20160916130347+02'00'" creationdate="D:20160909110219+02'00'">
<contents>Kostas! 123</contents>
</text>
<text page="0" color="#FFFF00" rect="288.766,720.275,312.016,743.525" width="0" opacity="1" icon="Comment" name="AnnotId-1841697" title="Kostas Ko..." date="D:20160916130347+02'00'" creationdate="D:20160916130114+02'00'">
<contents>High five! :)</contents>
</text>
</annots>
</xfdf>

E.g. above we don't have the :


<pages>
<defmtx matrix="1.3333333333333333,0,0,-1.3333333333333333,0,1122.56" />
</pages>

The flags are missing from annotations:

      flags="print,nozoom,norotate"

The <contents-richtext>, <contents> tags are missing.

Maybe some of those can be the root cause...
Although links are not part of the annotations and shouldn't be affected, but that's my best guess so far...

I will see if I can create a demo-project soon.

Thanks,
Kostas

Matt Parizeau

unread,
Nov 2, 2016, 7:23:59 PM11/2/16
to PDFTron WebViewer
Hi Kostas,

The XFDF that's returned from your server URL will override any annotations in your document, including links. See this post for more information: https://groups.google.com/d/msg/pdfnet-webviewer/bSCcdiKjIeM/-ftUCd2QFgAJ

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Gloogle Inc

unread,
Nov 7, 2016, 1:45:04 PM11/7/16
to PDFTron WebViewer
Yes, that was it !
I had not come across this page despite the fact I've searched the whole web.
Thank you a lot. :)
Reply all
Reply to author
Forward
0 new messages