[]
        
(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

Constructors

Constructor

new PageToolsPlugin(options?): PageToolsPlugin;

PageToolsPlugin constructor.

Parameters

options?

PageToolsPluginOptions

plugin options

Returns

PageToolsPlugin

Properties

id

readonly id: string;

Unique plugin identifier.


options

options: PageToolsPluginOptions;

Plugin options

Accessors

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


naturalSize

Get Signature

get naturalSize(): object;

Natural image size.

Returns

object

height
height: number;
width
width: number;

totalRotation

Get Signature

get totalRotation(): number;

Gets current rotation in degrees.

Returns

number

Methods

crop()

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

Crop image.

Parameters

x

number

y

number

width

number

height

number

Returns

Promise<boolean>


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>


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


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>