1JavaScript<label for="file_upload">Choose A file</label>
2<input type="file" id="file_upload" name="file_upload" accept=".pdf">
3
4<div id='viewer' style='width: 1024px; height: 600px;'></div>
5
6<script>
7 const input = document.getElementById('file_upload');
8
9 WebViewer(...)
10 .then(instance => {
11 input.addEventListener('change', () => {
12
13 // Get the file from the input
14 const file = input.files[0];
15 instance.loadDocument(file, { filename: file.name });
16 });
17
18 const { docViewer } = instance;
19 docViewer.on('documentLoaded', () => {
20 // perform document operations
21 });
22 });
23</script>fullscreenCopyRelated Links•WebViewerInstance.loadDocument