Skip to main content
Version: Version 5 beta

Class: TextSelectionLayer

Abstract base class for a Layer, which is an event emitter that renders on a native HTML element.

Extends

  • Layer<HTMLCanvasElement>

Constructors

Constructor

new TextSelectionLayer(id, documentViewPage): TextSelectionLayer

Creates an instance of Layer.

Parameters

id

string

The unique identifier for the layer.

documentViewPage

DocumentViewPage

The associated document view page.

Returns

TextSelectionLayer

Inherited from

Layer.constructor

Accessors

documentViewPage

Get Signature

get documentViewPage(): DocumentViewPage

Gets the document view page associated with this layer.

Returns

DocumentViewPage

Inherited from

Layer.documentViewPage


id

Get Signature

get id(): string

Gets the unique identifier of the layer.

Returns

string

Inherited from

Layer.id


nativeElement

Get Signature

get nativeElement(): T

Gets the native HTML element of this layer.

Returns

T

Inherited from

Layer.nativeElement


size

Get Signature

get size(): Size

Gets the size of the layer.

Returns

Size

Set Signature

set size(v): void

Sets the size of the layer and dispatches a size change event if the size is different.

Parameters
v

Size

The new size to be set.

Returns

void

Inherited from

Layer.size

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 "sizeChanged"

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

Layer.addEventListener


dispatchEvent()

dispatchEvent<K>(type, args): void

Dispatches an event to all registered listeners.

Type Parameters

K

K extends "sizeChanged"

A generic type representing the key of the event type.

Parameters

type

K

String representing the event type to dispatch.

args

Parameters<LayerEventMap[K]>

The data associated with the event.

Returns

void

Inherited from

Layer.dispatchEvent


dispose()?

optional dispose(): void

Optional cleanup method called when the layer is about to be removed. Override this method to release resources, remove event listeners, or perform any necessary cleanup. The PDF Web SDK calls this method automatically when a page is removed from the viewport.

Returns

void

Inherited from

Layer.dispose


removeAllListeners()

removeAllListeners<K>(type): void

Remove all listeners for a given event.

Type Parameters

K

K extends "sizeChanged"

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

Layer.removeAllListeners


removeEventListener()

removeEventListener<K>(type, listener): void

Removes an event listener previously registered with addEventListener.

Type Parameters

K

K extends "sizeChanged"

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

Layer.removeEventListener