Nutrient Web SDK
    Preparing search index...

    Type Alias RenderPageCallback

    RenderPageCallback: (
        context: CanvasRenderingContext2D,
        pageIndex: number,
        pageSize: NutrientViewer.Geometry.Size,
    ) => unknown

    This callback is called whenever a page is rendered or printed (only for NutrientViewer.PrintMode.DOM). You can use it to render watermarks on the page.

    Make sure that the rendering commands are as efficient as possible as they might be invoked multiple times per page (once per tile).

    For more information, see Configuration#renderPageCallback.

    Type Declaration

    Register a RenderPageCallback handler at configuration time.

    NutrientViewer.load({
    renderPageCallback: function(ctx, pageIndex, pageSize) {
    ctx.beginPath();
    ctx.moveTo(0, 0);
    ctx.lineTo(pageSize.width, pageSize.height);
    ctx.stroke();

    ctx.font = "30px Comic Sans MS";
    ctx.fillStyle = "red";
    ctx.textAlign = "center";
    ctx.fillText(
    `This is page ${pageIndex + 1}`,
    pageSize.width / 2,
    pageSize.height / 2
    );
    }
    // ...
    });