Namespace: CoreControls

CoreControls

The namespace containing WebViewer's core user controls, including DocumentViewer control and the Document class.

Classes

AnnotationManager
Bookmark
DisplayMode
DisplayModeManager
Document
DocumentViewer

Members


<static> CanvasMode

Canvas mode enumeration, has values of PageCanvas (default) and ViewportCanvas

Properties:
Name Type Description
ViewportCanvas string
PageCanvas string

<static> DisplayModes

Display modes that control how the document's page are displayed

Properties:
Name Type Description
Single string

Displays one page at a time.

Continuous string

Displays all the pages in a scrolling view in one column.

Facing string

Displays up to two pages at a time, side by side.

FacingContinuous string

Displays all pages in a scrolling view in two columns.

Cover string

Displays all pages in a scrolling view in two columns. The first row has a single page in the second column.

CoverFacing string

Same as the Cover display mode except that it is not a scrolling view.

Custom string

Any custom display mode.

Methods


<static> BaseDocument()

BaseDocument is used to alert if a Document implementation is not following the Document interface.


<static> disableEmbeddedJavaScript()

Disables the execution of embedded JavaScript


<static> getCurrentPDFBackendType()

Gets the current backend type being used.

Returns:

Returns "pnacl" is PNaCl is being used, "ems" if Emscripten is being used and undefined if nothing is being used yet

Type
string

<static> getDefaultBackendType()

Gets the default pdf backend type that should be used for this browser.

Returns:

Returns "pnacl" is PNaCl should be used and "ems" if Emscripten should be used

Type
string

<static> getWorkerPath()

Gets the path to the Web Worker JavaScript file

Returns:

The path to the worker

Type
string

<static> initPDFWorkerTransports(pdfBackendType, workerHandlers, l)

Begins setup of PDF Worker Object.

Parameters:
Name Type Description
pdfBackendType string

object representing an PDF backend type ("pnacl" or "ems")

workerHandlers object

object holding event and error handlers for the worker (workerLoadingProgress, pnaclCrashError, pnaclLoadError, emsWorkerError).

l string

The license key to use for this worker. If undefined PDFNet will be initialized in demo mode.

Returns:

a promise that will be resolved when worker transport initialization is complete.


<static> isDemoMode()

Returns whether demo mode is active or not. Must be called after the document is loaded or after the call to CoreControls.initPDFWorkerTransports if you're calling it directly.

Returns:

true or false depending on whether the viewer is in demo mode or not

Type
boolean

<static> preloadPDFWorker(pdfBackendType, workerHandlers, options)

Begins setup of PDF Worker Object. This can be used to load the workers before a license key has been loaded.

Parameters:
Name Type Description
pdfBackendType string

object representing an PDF backend type ("pnacl" or "ems")

workerHandlers object

object holding event and error handlers for the worker (workerLoadingProgress).

options object

An object with the following optional values: useEmscriptenWhileLoading If the backend type is set to pnacl then this determines whether emscripten should be used if PNaCl needs time to set up.

Returns:

The worker object

Type
object

<static> resetWorker(worker)

Resets the worker so that the next time initPDFWorkerTransports is called it will set up the worker transports with the specified worker.

Parameters:
Name Type Description
worker object

The new worker to use the next time initPDFWorkerTransports is called


<static> setAdvancedImageScaling(advanced)

Forces a higher level of accuracy in image downsampling at the expense of rendering performance. This function should be called before loading a document to ensure this setting is used.

Parameters:
Name Type Description
advanced bool

if true advanced image scaling will be used. Can alternatively pass a number for the number of downsampling steps to take. Passing true is equivalent to passing 1.4.


<static> SetCachingLevel(level)

Set the caching level between 0 and 10, where 0 is no caching and 10 uses a very large cache

Parameters:
Name Type Description
level number

The level to set


<static> SetCanvasMode(mode)

Sets the canvas rendering mode.

Parameters:
Name Type Description
mode CoreControls.CanvasMode

The canvas mode to switch to


<static> setEmscriptenHeapSize(The)

Adjusts the up front heap size used by Emscripten. This method must be called before the worker is initialized to change heap allocation behaviour. By default the heap size is set to 50331648 bytes. Note that decreasing the heap size very low or running complex operations may require a resize.

Parameters:
Name Type Description
The number

number of bytes to allocate for the Emscripten heap.


<static> SetPreRenderLevel(level)

Set the pre-render level between 0 and 10, where 0 has pre-rendering and 10 has a lot of pre-rendering.

Parameters:
Name Type Description
level number

The level to set


<static> setProgressiveTime(milliseconds)

Control the time between progressive events when rendering a more complex page.

Parameters:
Name Type Description
milliseconds number

the number of milliseconds between progressive events. By default this is disabled for XOD, 1 second (1000) for PNaCl and 3 seconds (3000) for Emscripten.


<static> setWorkerPath(path)

Sets the path to the Web Worker JavaScript file. By default the file is expected to be in the same directory as the html file of the viewer and the path should be specified relative to the html file

Parameters:
Name Type Description
path string

Path to the Web Worker JS file relative to the html file of the viewer