Skip to main content
Version: Version 5

Class: Controller

Class used for managing PDF documents.

Extends​

Implements​

Constructors​

Constructor​

new Controller(controllerOptions?): Controller

Parameters​

controllerOptions?​

ControllerOptions = {}

Returns​

Controller

Overrides​

EventEmitter.constructor

Methods​

addEventListener()​

addEventListener<K>(type, listener): void

Register a function that will be called whenever the specified event is delivered.

Type Parameters​

K​

K extends "workerErrorOcurred"

A generic type representing the key of the event type.

Parameters​

type​

K

String representing the event type to listen for.

listener​

(…e) => void

The function that will be executed when an event of the specified type occurs.

Returns​

void

Inherited from​

EventEmitter.addEventListener


dispatchEvent()​

dispatchEvent<K>(type, args): void

Dispatches an event to all registered listeners.

Type Parameters​

K​

K extends "workerErrorOcurred"

A generic type representing the key of the event type.

Parameters​

type​

K

String representing the event type to dispatch.

args​

Parameters<ControllerEventMap[K]>

The data associated with the event.

Returns​

void

Inherited from​

EventEmitter.dispatchEvent


dispose()​

dispose(): void

Disposes of the object, releasing any resources it holds.

The dispose method is responsible for performing cleanup operations and releasing any resources acquired by the object. Once an object is disposed, it should not be used, and attempts to do so may result in undefined behavior.

Returns​

void

Implementation of​

Disposable.dispose


initialize()​

initialize(): Promise<Controller>

Returns​

Promise<Controller>


isFeatureEnabled()​

isFeatureEnabled(featureId): boolean

Parameters​

featureId​

LicensedFeatureId

Returns​

boolean


openDocument()​

openDocument(inputDocument): Promise<Document>

Opens a PDF document from either a file or a remote URI.

Parameters​

inputDocument​

InputFile | InputUri

The input document to open.

Returns​

Promise<Document>

A Promise that resolves to a Pdf.Document.


removeAllListeners()​

removeAllListeners<K>(type): void

Remove all listeners for a given event.

Type Parameters​

K​

K extends "workerErrorOcurred"

A generic type representing the key of the event type.

Parameters​

type​

K

String representing the event for which to remove all listeners.

Returns​

void

Inherited from​

EventEmitter.removeAllListeners


removeEventListener()​

removeEventListener<K>(type, listener): void

Removes an event listener previously registered with addEventListener.

Type Parameters​

K​

K extends "workerErrorOcurred"

A generic type representing the key of the event type.

Parameters​

type​

K

String representing the event for which to remove an event listener.

listener​

(…e) => void

The event listener function of the event handler to remove from the event target.

Returns​

void

Inherited from​

EventEmitter.removeEventListener