Free Support Forum -

Custom annotation position


If I place a Custom annotation field like "Sign Here", can I get its co-ordinate on the file, so that I can use another third party dll to sign the document digitally, using pfx

if I get the exact co-ordinates of the annotation field, i can sign the doc with pfx.

Is this possible?


Hello Amit,

Thank you for your interest in GroupDocs.Annotation for .NET. Yes, you can obtain coordinates of every existing annotation programmatically, using the GroupDocs.Annotation API. Description is below.

1. First of all, you need to obtain a desired annotation, which coordinates you want to achieve. For achieving this you may obtain a list of all annotations for the specified document. Here is a source code:

//Filename - string variable, which contains a name of the document
Int64 sessionId = Groupdocs.Web.Annotation.FileSessionMapper.Instance[Filename];
if (sessionId == 0)

//this file has 0 annotations
Groupdocs.Core.IAnnotationService annotationSvc = StructureMap.ObjectFactory.GetInstance<Groupdocs.Core.IAnnotationService>();
Groupdocs.Data.Annotation[] annotations = annotationSvc.GetSessionAnnotations(sessionId);

2. Now you have a list of all annotations (annotations variable) for the specified document. Let’s say that you have defined only one specific annotation. For example:
Groupdocs.Data.Annotation one_annotation =
annotations.Single(a => a.User.LastName == “userlastname” && a.CreatedOn > DateTime.Now.AddDays(-1));

3. And now you can obtain all necessary coordinates from the fields of the “Groupdocs.Data.Annotation” instance: “AnnotationTop”, “AnnotationLeft”, “Height” and “Width”.

If you will have more questions please feel free to contact us.