Nutrient Web SDK
    Preparing search index...

    Function unload

    • Unloads an existing NutrientViewer instance.

      It requires an target parameter that is a CSS selector, an HTMLElement or the reference to a NutrientViewer.Instance returned by NutrientViewer.load.

      Parameters

      Returns boolean

      When true, an instance of Nutrient Web SDK was unmounted.

      let instance = null;
      NutrientViewer.load({
      document: "/sales-report.pdf",
      container: ".foo",
      }).then((i) => {
      instance = i
      })
      .then(() => {
      // Unload the given instance
      NutrientViewer.unload(instance)
      }).catch((error) => {
      console.error(error.message);
      })
      NutrientViewer.load({
      document: "/sales-report.pdf",
      container: ".foo",
      })
      .then(() => {
      // Unload the given instance
      NutrientViewer.unload(".foo")
      })
      NutrientViewer.load({
      document: "/sales-report.pdf",
      container: ".foo",
      })
      .then(() => {
      // Unload the given instance
      NutrientViewer.unload(document.querySelector(".foo"))
      })

      @public

      Will throw an error when the target is invalid but will work when it does not have a mounted Nutrient Web SDK instance.