Q:

pdftron file from local

JavaScript<label for="file_upload">Choose A file</label>
<input type="file" id="file_upload" name="file_upload" accept=".pdf">

<div id='viewer' style='width: 1024px; height: 600px;'></div>

<script>
  const input = document.getElementById('file_upload');

  WebViewer(...)
    .then(instance => {
      input.addEventListener('change', () => {

        // Get the file from the input
        const file = input.files[0];
        instance.loadDocument(file, { filename: file.name });
      });

      const { docViewer } = instance;
      docViewer.on('documentLoaded', () => {
        // perform document operations
      });
    });
</script>fullscreenCopyRelated Links•WebViewerInstance.loadDocument
0

New to Communities?

Join the community