CommitDrawnShape

Viewer interaction

Description

Creates a square, circle or ink annotation from client coordinates collected while drawing over the viewer surface

All points are mapped to the page under the first client point and the annotation is added to that page, which is selected for the call

Syntax

Delphi

Function TPDFlibViewer.CommitDrawnShape(Mode: TPDFlibViewerMode;
  Const ClientPoints: Array Of TPoint): Integer;

Parameters

ModevmDrawSquare, vmDrawCircle or vmDrawInk; any other mode commits nothing
ClientPointsClient coordinates of the drag, in order; at least two points are required

Return values

1The annotation was added to the document
0No annotation was added

Remarks

Returns 0 when no library is attached, the document has no pages, fewer than two points are passed, the first point does not land on a page, the target page cannot be selected or Mode is not one of the drawing modes

Square and circle annotations use the bounding rectangle of the mapped points; a point that lands on a different page aborts the call for those modes

The ink annotation records every point that belongs to the first point's page, skipping points over other pages, and formats the coordinates with two decimals

The annotation colour comes from DrawColor and the border width from DrawLineWidth; the previously selected page and the origin are restored after the call

A successful commit invalidates the rendered bitmap of the affected page and repaints the control

See also

DrawColor, DrawLineWidth, ViewerMode, CommitHighlightRegionsToAnnotations, TPDFlibViewer