ComPDFKit Web SDK
    Preparing search index...

    Interface CustomFillStyleOptions

    Options of UI.registerCustomFillStyle.

    interface CustomFillStyleOptions {
        appliesTo?: string[];
        clipToShape?: boolean;
        clipToShapeFn?: (
            ctx: CanvasRenderingContext2D,
            annotation: unknown,
        ) => void;
        drawHandler(
            ctx: CanvasRenderingContext2D,
            pageMatrix: unknown,
            rotation: number | undefined,
            options: Record<string, unknown>,
        ): void;
        key: string;
        svg?: string;
        title?: string;
    }
    Index
    • Draws the fill of an annotation; the canvas is already clipped to the annotation shape.

      Parameters

      • ctx: CanvasRenderingContext2D

        The canvas context being drawn on.

      • pageMatrix: unknown

        Transform from page coordinates to canvas coordinates.

      • rotation: number | undefined

        Rotation of the page.

      • options: Record<string, unknown>

        { annotation, originalDraw, originalDrawWithoutFill, clipToShape }: the annotation, a function drawing its original appearance (once), a function asking for the original appearance to be drawn with no fill after the handler returns (so the border goes over the custom fill), and a function clipping to the shape again.

      Returns void

    appliesTo?: string[]

    Annotation types the style applies to: 'all' (default), 'rectangle', 'ellipse' or 'polygon'.

    clipToShape?: boolean

    When true, drawing is clipped with clipToShapeFn instead of the built-in clipping to the annotation shape; false by default.

    clipToShapeFn?: (ctx: CanvasRenderingContext2D, annotation: unknown) => void

    Clips the canvas to the annotation shape; required when clipToShape is true.

    Type Declaration

      • (ctx: CanvasRenderingContext2D, annotation: unknown): void
      • Parameters

        • ctx: CanvasRenderingContext2D

          The canvas context being drawn on.

        • annotation: unknown

          The annotation being drawn.

        Returns void

    key: string

    Unique key of the style; an annotation uses the style when its FillStyle property is set to this key. 'solid' is reserved. Registering the same key again replaces the style.

    svg?: string

    SVG preview of the style. Kept with the style; it is not shown (there is no fill style dropdown).

    title?: string

    Display name of the style; defaults to the key. Kept with the style; it is not shown (there is no fill style dropdown).