[]
Page Tools Plugin. Adds the "Page tools" button.
<script src="gcimageviewer.js"></script></head>
<script src="plugins/pageTools.js"></script>
<script>
const viewer = new DsImageViewer("#root");
viewer.addPlugin(new PageToolsPlugin());
</script>
viewer: ImageViewerAPI;
Gets the image viewer instance. The image viewer instance.
PageToolsPluginAPI.viewer
options: PageToolsPluginOptions;
Plugin options
PageToolsPluginAPI.options
totalRotation: number;
Gets current rotation in degrees.
PageToolsPluginAPI.totalRotation
paintLayer: ImageLayer;
Gets the paint layer containing the HTML canvas for drawing the image.
PageToolsPluginAPI.paintLayer
isReady: boolean;
Returns true if the image is loaded into the viewer and the image format is supported by the Image Filters plugin.
PageToolsPluginAPI.isReady
naturalSize: Size;
Natural image size.
PageToolsPluginAPI.naturalSize
id: PluginType;
Unique plug-in identifier.
PageToolsPluginAPI.id
rotate(angle): Promise<boolean>;
Rotate image.
number
Angle to rotate an image.
Promise<boolean>
PageToolsPluginAPI.rotate
crop(
x,
y,
width,
height): Promise<boolean>;
Crop image.
number
Leftmost point of a new image rectangle
number
Topmost point of a new image rectangle
number
Width a new image rectangle
number
Height a new image rectangle
Promise<boolean>
Whether transformation was applied successfully or not.
PageToolsPluginAPI.crop
resize(
width,
height,
keepAspectRatio): Promise<boolean>;
Resize image.
number
New image width.
number
New image height
boolean
Explicitly defines a need of keeping an original image aspect ratio. Defaults to true.
Promise<boolean>
PageToolsPluginAPI.resize
flip(horizontal, vertical): Promise<boolean>;
Flip image.
boolean
Flip horizontally. True by default.
boolean
Promise<boolean>
Whether transformation was applied successfully or not.
PageToolsPluginAPI.flip
flipHorizontal(): Promise<boolean>;
Flip image horizontally.
Promise<boolean>
Whether transformation was applied successfully or not.
PageToolsPluginAPI.flipHorizontal
flipVertical(): Promise<boolean>;
Flip image vertically.
Promise<boolean>
Whether transformation was applied successfully or not.
PageToolsPluginAPI.flipVertical
isImageFormatSupported(imageFormat, allowUnknown?): boolean;
Determines whether the specified image format is supported for modifications.
The image format to check, either as an enum value or string.
string | ImageFormatCode
boolean
If true, allows unknown formats (ImageFormatCode.Default) to be considered supported.
boolean
True if the format is supported for modifications, false otherwise.
The following formats are explicitly not supported:
// Check if PNG is supported
const supported = isImageFormatSupported(ImageFormatCode.PNG);
// Check if an unknown format is supported (returns false by default)
const supported = isImageFormatSupported('custom-format');
// Check if an unknown format is supported (returns true when allowUnknown is true)
const supported = isImageFormatSupported('custom-format', true);
PageToolsPluginAPI.isImageFormatSupported
dispose(): void;
Cleans up resources and disposes the plugin.
void
PageToolsPluginAPI.dispose
removePaintLayer(): void;
Removes and disposes the active paint layer. If no paint layer exists, this method does nothing.
void
PageToolsPluginAPI.removePaintLayer
initialize(viewer): void;
The method is called when the GcImageViewer component is initialized.
void
PageToolsPluginAPI.initialize