Some test text!

platform
search

Core

Contents

Interacting with Core
Main namespaces and classes

Core is the main engine that does document processing, canvas rendering and annotation managing.

linkInteracting with Core

Core provide an access point through a few global variables, one of them being CoreControls. This is a namespace containing WebViewer's main classes, objects and methods.

If you are using the default UI or legacy UI, you rarely have to worry about calling Core functions directly. However, you can choose not to use the provided UIs and create your own from scratch. The example below shows how to load a document in a custom viewer.

Note that when loading CoreControls.js directly yourself you'll also need to include jQuery.
<!-- custom-ui.html -->
<html>
  <body>
    <h1>This is a custom viewer</h1>
    <div id='scroll-view'>
      <div id='viewer'></div>
    </div>
    <script src="core/external/jquery-3.2.1.min.js"></script>
    <script src="core/external/html2canvas.min.js"></script>
    <script src="core/CoreControls.js"></script>
    <script src="custom-ui.js"></script>
  </body>
</html>
// custom-ui.js
CoreControls.setWorkerPath('lib/core');

CoreControls.getDefaultPdfBackendType().then(function(backendType) {
  var licenseKey = 'YOUR_LICENSE_KEY_HERE';
  var workerTransportPromise = CoreControls.initPDFWorkerTransports(backendType, {}, licenseKey);

  var docViewer = new CoreControls.DocumentViewer();
  var partRetriever = new CoreControls.PartRetrievers.ExternalPdfPartRetriever('path/to/document.pdf');

  docViewer.setScrollViewElement(document.getElementById('scroll-view'));
  docViewer.setViewerElement(document.getElementById('viewer'));
  docViewer.loadAsync(partRetriever, {
    type: 'pdf',
    backendType: backendType,
    workerTransportPromise: workerTransportPromise
  });

  docViewer.on('documentLoaded', function() {
    console.log('document loaded');
  });
});

linkMain namespaces and classes

Some of the main namespaces and classes that Core exposes are:

See API documentation for the full list.

Get the anwsers you need: Support

Contents

Interacting with Core
Main namespaces and classes