Document Solutions Image Viewer
    Preparing search index...

    Class PageToolsPlugin

    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>

    Constructors

    Methods

    • Rotate image.

      Parameters

      • angle: number

        Angle to rotate an image.

      Returns Promise<boolean>

    • Crop image.

      Parameters

      • x: number

        Leftmost point of a new image rectangle

      • y: number

        Topmost point of a new image rectangle

      • width: number

        Width a new image rectangle

      • height: number

        Height a new image rectangle

      Returns Promise<boolean>

      Whether transformation was applied successfully or not.

    • Resize image.

      Parameters

      • width: number

        New image width.

      • height: number

        New image height

      • keepAspectRatio: boolean

        Explicitly defines a need of keeping an original image aspect ratio. Defaults to true.

      Returns Promise<boolean>

    • Flip image.

      Parameters

      • horizontal: boolean

        Flip horizontally. True by default.

      • vertical: boolean

      Returns Promise<boolean>

      Whether transformation was applied successfully or not.

    • Flip image horizontally.

      Returns Promise<boolean>

      Whether transformation was applied successfully or not.

    • Flip image vertically.

      Returns Promise<boolean>

      Whether transformation was applied successfully or not.

    • Determines whether the specified image format is supported for modifications.

      Parameters

      • imageFormat: string | ImageFormatCode

        The image format to check, either as an enum value or string.

      • OptionalallowUnknown: boolean

        If true, allows unknown formats (ImageFormatCode.Default) to be considered supported.

      Returns boolean

      True if the format is supported for modifications, false otherwise.

      The following formats are explicitly not supported:

      • TIFF (ImageFormatCode.TIFF)
      • SVG (ImageFormatCode.SVG)
      • ICO (ImageFormatCode.ICO)
      • GIF (ImageFormatCode.GIF)
      // 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);
    • Cleans up resources and disposes the plugin.

      Returns void

    • Removes and disposes the active paint layer. If no paint layer exists, this method does nothing.

      Returns void

    • The method is called when the GcImageViewer component is initialized.

      Parameters

      Returns void

    Properties

    Gets the image viewer instance. The image viewer instance.

    Plugin options

    totalRotation: number

    Gets current rotation in degrees.

    paintLayer: ImageLayer

    Gets the paint layer containing the HTML canvas for drawing the image.

    isReady: boolean

    Returns true if the image is loaded into the viewer and the image format is supported by the Image Filters plugin.

    naturalSize: Size

    Natural image size.

    Unique plug-in identifier.