Display document loading progress

90 views
Skip to first unread message

sbi

unread,
Apr 7, 2017, 4:35:09 AM4/7/17
to PDFTron WebViewer
Hi guys,

we have a lot of customers opening huge files in the webviewer (1000+ pages).
This can lead to long initialization times between viewerLoaded and documentLoaded where the user does not know if the document is loading at all.

Would it be possible for you to add a progress bar to the viewer displaying the loading state to the viewer?
If a progress bar displaying the real percentage progress is not possible a spinner or something else would be welcome.

Thanks a lot.

Justin Jung

unread,
Apr 7, 2017, 4:20:38 PM4/7/17
to PDFTron WebViewer on behalf of sbi
Hello,

Currently, there is no exposed way to track the progress of the document loading. Here is an example of adding a spinner inside config file:

var spinner = $('<img>');
spinner.css({
  position: 'absolute',
  width: '100px',
  height: '100px',
  top: '50%',
  left: '50%',
  transform: 'translate(-50%, -50%)'
});

$(document).on('viewerLoaded', function() {
  $('#DocumentViewer').append(spinner);
});

$(document).on('documentLoaded', function() {
  spinner.remove();
});

Justin Jung
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages