[]
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>
id: PluginType;
Unique plug-in identifier.
PageToolsPluginAPI.id
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
options: PageToolsPluginOptions;
Plugin options
PageToolsPluginAPI.options
paintLayer: ImageLayer;
Gets the paint layer containing the HTML canvas for drawing the image.
PageToolsPluginAPI.paintLayer
totalRotation: number;
Gets current rotation in degrees.
PageToolsPluginAPI.totalRotation
viewer: ImageViewerAPI;
Gets the image viewer instance. The image viewer instance.
PageToolsPluginAPI.viewer
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
dispose(): void;
Cleans up resources and disposes the plugin.
void
PageToolsPluginAPI.dispose
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
initialize(viewer): void;
The method is called when the GcImageViewer component is initialized.
void
PageToolsPluginAPI.initialize
isImageFormatSupported(imageFormat, allowUnknown?): boolean;
Determines whether the specified image format is supported for modifications.
string | ImageFormatCode
The image format to check, either as an enum value or string.
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
removePaintLayer(): void;
Removes and disposes the active paint layer. If no paint layer exists, this method does nothing.
void
PageToolsPluginAPI.removePaintLayer
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
rotate(angle): Promise<boolean>;
Rotate image.
number
Angle to rotate an image.
Promise<boolean>
PageToolsPluginAPI.rotate