[]
        
(Showing Draft Content)

PageToolsPlugin

Document Solutions Image Viewer - v8.0.0 / 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

Table of contents

Properties

Constructors

Accessors

Methods

Properties

id

Readonly id: string = "pageTools"

Unique plugin identifier.


options

options: PageToolsPluginOptions

Plugin options

Constructors

constructor

new PageToolsPlugin(options?)

PageToolsPlugin constructor.

Parameters

Name Type Description
options? PageToolsPluginOptions plugin options

Accessors

isReady

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


naturalSize

get naturalSize(): Object

Natural image size.

Returns

Object

Name Type
width number
height number

totalRotation

get totalRotation(): number

Gets current rotation in degrees.

Returns

number

Methods

rotate

rotate(rotation): Promise<boolean>

Rotate image.

Parameters

Name Type
rotation number

Returns

Promise<boolean>


isImageFormatSupported

isImageFormatSupported(imageFormat, allowUnknown?): boolean

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

Parameters

Name Type
imageFormat string | ImageFormatCode
allowUnknown? boolean

Returns

boolean


crop

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

Crop image.

Parameters

Name Type
x number
y number
width number
height number

Returns

Promise<boolean>


resize

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

Resize image.

Parameters

Name Type Default value
width number undefined
height number undefined
keepAspectRatio boolean true

Returns

Promise<boolean>


flip

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

Flip image.

Parameters

Name Type Default value
horizontal boolean true
vertical boolean false

Returns

Promise<boolean>


flipHorizontal

flipHorizontal(): Promise<boolean>

Flip image horizontally.

Returns

Promise<boolean>


flipVertical

flipVertical(): Promise<boolean>

Flip image vertically.

Returns

Promise<boolean>