Search results

Unload the PDF document Programmatically in JavaScript (ES5) PDF Viewer control

06 Jun 2023 / 1 minute to read

The PDF Viewer library allows you to unload the PDF document being display in the PDF Viewer control programmatically using the unload() method.

The following steps are used to unload the PDF document programmatically.

Step 1: Follow the steps provided in the link to create a simple PDF Viewer sample.

Step 2: Add the following code snippet to perform the unload operation.

Copied to clipboard
  <button id="unload">Unload Document</button>  
Copied to clipboard
document.getElementById('unload').addEventListener('click', () => {
   // Unload the document.
  viewer.unload();
});

Find the Sample, how to unload the PDF document programmatically