How to group freehand annotation strokes together?


I am adding stylus drawing support to my app using PDFViewWPF. By default, whenever the user lifts the stylus up after drawing, a new annotation is created every time. How do I create FreeHand annotations that contain multiple disconnected paths?

The FreeHand class in PDFViewWPF tools creates Ink class in the PDF. Ink annotations are made up of a set of paths, and each path has a set of points. So each Path is a continuous line, but the annotation as a whole can be made up of thousands of connected and/or disconnected paths.

See Ink.SetPoint function, where the first parameter is the path index.

So you create a single annotation, and every time the user lifts the stylus up, you increment the path counter, so if they start drawing again, this will be a new path, but part of the same annotation.

Typically apps use a button to enter/exit drawing mode.