Unload document in Vue Pdfviewer component

16 Mar 20231 minute to read

The PDF Viewer library allows you to unload the PDF document being displayed 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.

        <button v-on:click="unload">Unload Document</button>


import Vue from 'vue';
import { PdfViewerPlugin, Toolbar, Magnification, Navigation, LinkAnnotation, 
         BookmarkView,ThumbnailView, Print,TextSelection, TextSearch, 
         Annotation, FormDesigner, FormFields } from '@syncfusion/ej2-vue-pdfviewer';

export default {
  data () {
    return {
  provide: {
  PdfViewer: [ Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView,
               Print, TextSelection, TextSearch, Annotation, FormDesigner, FormFields ]},

  methods: {
    unload: function() {
      var viewer = document.getElementById('pdfViewer').ej2_instances[0];
      // Unload the PDF document.

Find the Sample, how to unload the PDF document programmatically