large XOD streaming cloudfront url search text very long time

Skip to first unread message

Jayaseelan A

Sep 19, 2014, 5:22:22 AM9/19/14

We have found that with large cloudfront XOD files streaming can take a long time to load the entire document, later pages search text  to display long time in the side panel web viewer.

Is search text entire document immediately once the document Loaded event fires?


Matt Parizeau

Sep 19, 2014, 1:39:04 PM9/19/14
Hi Jayaseelan,

We would highly recommend that you don't use streaming mode if you don't have to. Streaming mode refers to a streaming XOD conversion and if you have already converted your files to XOD then you should use the option streaming: false.

Think of the distinction more as one option uses HTTP range requests and the other doesn't. When streaming = false then range requests are used and only the specific part of the document that you are currently viewing is downloaded.

When range requests are NOT used (streaming = true) then the document is downloaded and parsed as the download happens, however the entire file is downloaded and parsed up front! This can be very slow for a large document (as you've noticed) and even though parts of the document are visible, the browser is still parsing the rest of the file and slowing things down.

The documentLoaded event fires after some initial parts of the document have been downloaded and WebViewer knows how many pages and their sizes it needs to display. At this point you can start adding things to document that depend on the pages (e.g. annotations) and you can start searching. Searching still requires the text of the page to be downloaded and parsed, however when documentLoaded is fired then the viewer is still downloading and parsing other things for rendering pages (especially for non-range requests). Without range requests you're searching at the same time as the browser is trying to download and parse everything else which makes it slow.

In summary, don't use non-range requests (streaming) if you don't have to. Use range requests (streaming: false) and it will greatly improve the performance for large files.

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