Module: @pdftron/webviewer-3d

This is an addon for WebViewer that allows loading 3d model files (.gltf, .glb) so that the model can be annotated. See the npm package on @pdftron/webviewer-3d for more information.

Methods


<async, static> initialize3dViewer(instance, options)

Initializes the model viewer so that WebViewer can load gltf/glb files.
Parameters:
Name Type Description
instance Object The WebViewer instance
options Object Options object.
Properties
Name Type Argument Default Description
license string <optional>
'' The WebViewer 3d license.
Returns:
A promise that resolves to an object containing the functions needed to load models in WebViewer.
Type
AudioFunctions
Example
WebViewer(...)
    .then(function(instance) {
      const license = '---- Insert commercial license key here after purchase ----';
      const {
        loadModel,
      } = await initialize3dViewer(
        instance,
        {
          license,
        },
      );

      loadModel('https://www.mydomain.com/my_gltf_url.gltf');
    });

Type Definitions


loadModel(modelUrl)

Parameters:
Name Type Description
modelUrl string The glb/gltf url
Returns:
Type
void

ThreedFunctions

Type:
  • Object
Properties:
Name Type Description
loadModel function Loads a glb/gltf file for the WebViewer instance passed into initialize3dViewer.
Example
WebViewer(...)
    .then(function(instance) {
      const license = '---- Insert commercial license key here after purchase ----';
      const {
        loadModel,
      } = await initialize3dViewer(
        instance,
        {
          license,
        },
      );

      loadModel('https://www.mydomain.com/my_gltf_url.gltf');
    });