[]
        
(Showing Draft Content)

PageToolsPlugin

Class: PageToolsPlugin

PageToolsPlugin class. Adds the "Page tools" button.

Example

<script src="gcimageviewer.js"></script></head>
<script src="plugins/pageTools.js"></script>
<script>
  var viewer = new DsImageViewer("#root");
  viewer.addPlugin(new PageToolsPlugin());
</script>

Param

Extends

  • ImageViewerPluginBase

Constructors

Constructor

new PageToolsPlugin(options?): PageToolsPlugin;

PageToolsPlugin constructor.

Parameters

options?

PageToolsPluginOptions

plugin options

Returns

PageToolsPlugin

Overrides

ImageViewerPluginBase.constructor

Properties

id

readonly id: PluginType;

Unique plugin identifier.

Overrides

ImageViewerPluginBase.id

options

options: PageToolsPluginOptions;

Plugin options

Accessors

in17n

Get Signature

get in17n(): i18n;

Gets the internationalization (i18n) instance from the viewer.

Returns

i18n

The i18n instance.

Overrides

ImageViewerPluginBase.in17n

isReady

Get Signature

get isReady(): boolean;

Returns true if the image is loaded into the viewer and the image format is supported by the Page Tools plugin.

Returns

boolean

Overrides

ImageViewerPluginBase.isReady

naturalSize

Get Signature

get naturalSize(): object;

Natural image size.

Returns

object

height
height: number;
width
width: number;

Overrides

ImageViewerPluginBase.naturalSize

paintLayer

Get Signature

get paintLayer(): IImageLayer;

Gets the paint layer containing the HTML canvas for drawing the image.

Returns

IImageLayer

Inherited from

ImageViewerPluginBase.paintLayer

totalRotation

Get Signature

get totalRotation(): number;

Gets current rotation in degrees.

Returns

number


viewer

Get Signature

get viewer(): IImageViewer;

Gets the image viewer instance.

Returns

IImageViewer

The image viewer instance.

Overrides

ImageViewerPluginBase.viewer

Methods

crop()

crop(
   x, 
   y, 
   width, 
   height): Promise<boolean>;

Crop image.

Parameters

x

number

y

number

width

number

height

number

Returns

Promise<boolean>


dispose()

dispose(): void;

Cleans up resources and disposes the plugin.

Returns

void

Overrides

ImageViewerPluginBase.dispose

flip()

flip(horizontal?, vertical?): Promise<boolean>;

Flip image.

Parameters

horizontal?

boolean

vertical?

boolean

Returns

Promise<boolean>


flipHorizontal()

flipHorizontal(): Promise<boolean>;

Flip image horizontally.

Returns

Promise<boolean>


flipVertical()

flipVertical(): Promise<boolean>;

Flip image vertically.

Returns

Promise<boolean>


initialize()

initialize(viewer): void;

Initializes the plugin with the given image viewer.

Parameters

viewer

any

The image viewer instance to associate with this plugin.

Returns

void

Overrides

ImageViewerPluginBase.initialize

isImageFormatSupported()

isImageFormatSupported(imageFormat, allowUnknown?): boolean;

Checks if the image format specified by the imageFormat parameter is supported.

Parameters

imageFormat

string | ImageFormatCode

allowUnknown?

boolean

Returns

boolean

Overrides

ImageViewerPluginBase.isImageFormatSupported

removePaintLayer()

removePaintLayer(): void;

Removes and disposes the active paint layer. If no paint layer exists, this method does nothing.

Returns

void

Inherited from

ImageViewerPluginBase.removePaintLayer

resize()

resize(
   width, 
   height, 
   keepAspectRatio?): Promise<boolean>;

Resize image.

Parameters

width

number

height

number

keepAspectRatio?

boolean

Returns

Promise<boolean>


rotate()

rotate(rotation): Promise<boolean>;

Rotate image.

Parameters

rotation

number

Returns

Promise<boolean>