Nutrient Web SDK
    Preparing search index...

    Function preloadWorker

    • Standalone

      Preloads the standalone WASM worker.

      In cases where you don't want to load a PDF right away, the first invocation of NutrientViewer.load after allowing this function to resolve will be significantly faster.

      If NutrientViewer.load is called while this function has not yet resolved, then NutrientViewer.load will simply reuse the request from this function without adding any overhead.

      Parameters

      • configuration: StandaloneConfiguration

        A configuration Object

      Returns Promise<void>

      Promise that resolves when preloading is complete

      // Fetches worker asynchronously
      NutrientViewer.preloadWorker(configuration);
      document.querySelector("#open-pdf-button").addEventListener(async () => {
      await NutrientViewer.load({ ...configuration, document: "my-doc.pdf" });
      });

      @standalone