You are viewing limited content. For full access, please sign in.

Question

Question

SDK RA apply freehand annotation

asked on September 27, 2017

Does anyone have a code sample for applying a freehand annotation through the SDK?  I have a list of points that I want to use to create a freehand annotation on the image.  Any code samples to do this with RA would be very helpful.

0 0

Answer

SELECTED ANSWER
replied on September 27, 2017

Given a list of points:

int pageNum = 1;
PageInfo page = document.GetPageInfo(pageNum);

var ann = new FreeHandAnnotation(document.Id, page.PageId, session);

foreach (Point pt in points)
{
    if (pt == null)
        ann.AddBreak();
    else
        ann.AddPoint(new LfPoint(pt.X, pt.Y));
}

page.AddAnnotation(ann);
ann.Save();
page.Save();

 

2 0
replied on September 27, 2017 Show version history

Robert

Thanks so much for that sample.

So if we have multiple lines in a single freehand annotation, just put a null point between them in the points list?

0 0
replied on September 27, 2017

Correct.

0 0
replied on July 7, 2021

Thanks, Robert. I would never have gotten this syntax:

ann.AddPoint(new LfPoint(pt.X, pt.Y));

in a million years.

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.