WebViewer Events and other questions

122 views
Skip to first unread message

Volker Andres

unread,
Sep 20, 2017, 6:25:35 PM9/20/17
to PDFTron WebViewer
Hi

Is there a list of all events the WebViewer is throwing?

In concrete, we need to know, when the document is fully loaded. There seems to be an issue with the "Mark Text" annotation, which will only allow marking text when the document is fully loaded. We have a custom 3.0.0 build with the old marker behaviour.

Another problem we found: When loading a document this seems to be done with a synchronous AJAX request blocking all other requests. Is there a way, that the document is loaded asynchronous?

Best Regards

Matt Parizeau

unread,
Sep 21, 2017, 5:44:41 PM9/21/17
to PDFTron WebViewer
Hi Volker,

Here is a list of events fired from PDFTron.WebViewer's element https://www.pdftron.com/webviewer/demo/doc/PDFTron.WebViewer.html#toc49__anchor
And here is a list from DocumentViewer, but you'll also be able to find events from other objects at that link https://www.pdftron.com/webviewer/demo/lib/html5/doc/symbols/CoreControls.DocumentViewer.html#toc65__anchor

Are you loading PDF or XOD documents? At what point do you see a synchronous AJAX request blocking other requests? WebViewer should only be doing synchronous AJAX requests occasionally inside a Web Worker for linearized PDF documents, so it shouldn't affect the main thread.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Volker Andres

unread,
Sep 26, 2017, 1:56:41 PM9/26/17
to PDFTron WebViewer
Hi Matt,

We are using XOD files. I found the code in CoreControls.js and can see, that the request is constructed async. Maybe we have a problem on our server side.

What is the event, which is thrown after the document is fully loaded? "documentLaoded" is thrown too early.

Best regards,
Volker

Volker Andres

unread,
Sep 26, 2017, 1:56:41 PM9/26/17
to PDFTron WebViewer
Hi Matt,

Can you maybe give an answer to that question: Why can I not mark text, until the document is fully loaded?

Regards,

Volker

Am Donnerstag, 21. September 2017 23:44:41 UTC+2 schrieb Matt Parizeau:

Matt Parizeau

unread,
Sep 27, 2017, 7:36:24 PM9/27/17
to PDFTron WebViewer
Hi Volker,

To clarify, you're referring to selecting text using the text select tool? Are you loading your XOD documents using streaming true or false?

If you're loading them with streaming true then the entire file is being downloaded and you can only select text once the text data for the page has finished downloading. When using streaming false this happens very quickly and you shouldn't notice much, if any delay.

If you want to know when the text data is ready for a page you could call readerControl.docViewer.getDocument().loadPageText(pageIndex, callback) and the callback will be called when the text is loaded for that page. Note that this data is cached so you won't be making an extra request for it and it will return immediately if it's in the cache.

If you don't think this is the problem could you describe in more detail the issue that you're seeing.

Thanks,

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Volker Andres

unread,
Sep 28, 2017, 1:39:05 PM9/28/17
to PDFTron WebViewer
Hi Matt,

You are right, we are using streaming:true, because the document is streamed from a server. If we use streaming:false we get: "Invalid XOD file: Zip end header data is wrong size!" Is there a way to use streaming:false anyhow then?

Using "readerControl.docViewer.getDocument().loadPageText(pageIndex, callback)" helps us, thank you.

Regards,
Volker

Matt Parizeau

unread,
Sep 28, 2017, 4:07:34 PM9/28/17
to PDFTron WebViewer
Hi Volker,

Are you XOD files preconverted or are you converting on the fly? If you're converting on the fly then you'll need to use streaming: true. If your XOD files are preconverted and you're still getting the zip end header error then that means your server doesn't support range requests. WebViewer tries to request for a range of bytes on the file and if your server returns the entire file data instead then WebViewer will throw that error.

Here is a link that describes handling range requests manually on your server https://groups.google.com/d/msg/pdfnet-webviewer/uxusjHnN46E/JqN-reYoBQAJ

Matt Parizeau
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages