WebViewer Offline Mode

37 views
Skip to first unread message

Kristian Hein

unread,
Oct 17, 2016, 8:48:45 PM10/17/16
to PDFTron WebViewer
Question:

I want to use offline mode for WebViewer but there are few different options. What is the best way to get started?

Answer:

The enableOfflineMode option will add two buttons to the UI. One to download the file to the offline database and one to toggle between whether the file data is being loaded from the offline database or not. The toggle button is only active if the file is currently stored in the offline database.

So the user would have to start in an online state. Their flow might start by pressing the download button and then continue viewing the document online. When the download finishes they could press the toggle button which would cause WebViewer to load any future data from the offline database. If they later refresh the browser they would again have to start in an online state and then press the toggle button to switch to loading from the offline database. In the mobile viewer if you press the menu button (three horizontal lines) you should see a button to download the file and then switch to offline mode. Once you've downloaded the file and switched to offline mode then you can disable your internet connection and continue to view the document.

The startOffline option requires that the document had previously been downloaded to the offline database. It could have been done by the download button mentioned above or it could have been done programmatically like in the offline library sample. When startOffline is true it will always load the document from the offline database which allows the document (and page) to be opened from a completely offline state like in the offline library sample.

Reply all
Reply to author
Forward
0 new messages