[]
Defines Page Tools Plugin API.
id: PluginType;
Unique plug-in identifier.
ImageViewerPluginAPI.id
readonly paintLayer: ImageLayer;
Gets the paint layer containing the HTML canvas for drawing the image.
ImageViewerPluginAPI.paintLayer
readonly isReady: boolean;
Returns true if the image is loaded into the viewer and the image format is supported by the Image Filters plugin.
ImageViewerPluginAPI.isReady
readonly naturalSize: Size;
Natural image size.
ImageViewerPluginAPI.naturalSize
options: PageToolsPluginOptions;
Plugin options
readonly totalRotation: number;
Gets current rotation in degrees.
initialize(viewer): void;
The method is called when the GcImageViewer component is initialized.
void
ImageViewerPluginAPI.initialize
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);
ImageViewerPluginAPI.isImageFormatSupported
dispose(): void;
Cleans up resources and disposes the plugin.
void
ImageViewerPluginAPI.dispose
removePaintLayer(): void;
Removes and disposes the active paint layer. If no paint layer exists, this method does nothing.
void
ImageViewerPluginAPI.removePaintLayer
rotate(angle): Promise<boolean>;
Rotate image.
number
Angle to rotate an image.
Promise<boolean>
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.
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>
flip(horizontal, vertical): Promise<boolean>;
Flip image.
boolean
Flip horizontally. True by default.
boolean
Promise<boolean>
Whether transformation was applied successfully or not.
flipHorizontal(): Promise<boolean>;
Flip image horizontally.
Promise<boolean>
Whether transformation was applied successfully or not.
flipVertical(): Promise<boolean>;
Flip image vertically.
Promise<boolean>
Whether transformation was applied successfully or not.