The unique identifier of the existing annotation object to which the new comment is related.
The horizontal (X) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
The vertical (Y) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
The width of the annotation bounding box, in inches.
The height of the annotation bounding box, in inches.
Example





In This Topic

AddCommentAnnot Method (AnnotationManager)

In This Topic
Adds and attaches a new GdPicture/XMP comment annotation to already existing annotation located on the selected page of the document currently handled by this AnnotationManager object according to the parameters you have specified. A comment annotation enables users to share information (comments, answers, reviews) related to the connected annotation.

The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypeComment. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationComment class right after the successful creation of the annotation object.

Be aware that annotations are always treated relative to the currently selected page.

Syntax
'Declaration
 
Public Function AddCommentAnnot( _
   ByVal PreviousGuid As String, _
   ByVal Left As Single, _
   ByVal Top As Single, _
   ByVal Width As Single, _
   ByVal Height As Single _
) As AnnotationComment
public AnnotationComment AddCommentAnnot( 
   string PreviousGuid,
   float Left,
   float Top,
   float Width,
   float Height
)
public function AddCommentAnnot( 
    PreviousGuid: String;
    Left: Single;
    Top: Single;
    Width: Single;
    Height: Single
): AnnotationComment; 
public function AddCommentAnnot( 
   PreviousGuid : String,
   Left : float,
   Top : float,
   Width : float,
   Height : float
) : AnnotationComment;
public: AnnotationComment* AddCommentAnnot( 
   string* PreviousGuid,
   float Left,
   float Top,
   float Width,
   float Height
) 
public:
AnnotationComment^ AddCommentAnnot( 
   String^ PreviousGuid,
   float Left,
   float Top,
   float Width,
   float Height
) 

Parameters

PreviousGuid
The unique identifier of the existing annotation object to which the new comment is related.
Left
The horizontal (X) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
Top
The vertical (Y) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
Width
The width of the annotation bounding box, in inches.
Height
The height of the annotation bounding box, in inches.

Return Value

A GdPicture/XMP AnnotationComment object. The newly added GdPicture/XMP comment annotation.
Remarks
Please ensure that you have selected the proper page before starting any annotation related action with the handled document. Annotations are always treated relative to the currently selected page.

You can regularly apply the GetStat method to determine if this method has been successful.

Example
How to add a comment annotation to each ruler annotation in the handled file.
Using annotationManager As AnnotationManager = New AnnotationManager()
    If (annotationManager.InitFromFile("test.jpeg") = GdPictureStatus.OK) AndAlso
       (annotationManager.PageCount > 0) AndAlso (annotationManager.SelectPage(1) = GdPictureStatus.OK) Then
        Dim annotCount As Integer = annotationManager.GetAnnotationCount()
        Dim annot As GdPicture14.Annotations.Annotation = Nothing
        For a As Integer = 0 To annotCount - 1
            annot = annotationManager.GetAnnotationFromIdx(a)
            If annot IsNot Nothing Then
                Dim type As GdPicture14.Annotations.Annotation.GdPictureAnnotationType = annotationManager.GetAnnotationType(a)
                If type = GdPicture14.Annotations.Annotation.GdPictureAnnotationType.AnnotationTypeRuler Then
                    Dim comment As GdPicture14.Annotations.AnnotationComment = annotationManager.AddCommentAnnot(annot.Guid, annot.Left, annot.Top, 1, 1)
                    If comment IsNot Nothing Then
                        comment.Text = "To be customized."
                    End If
                End If
            End If
        Next
        If (annotationManager.SaveAnnotationsToPage() = GdPictureStatus.OK) AndAlso
           (annotationManager.SaveDocumentToJPEG("test_reviewed.jpeg", 75) = GdPictureStatus.OK) Then
            MessageBox.Show("Done!", "AnnotationManager.AddCommentAnnot")
        Else
            MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddCommentAnnot")
        End If
        annotationManager.Close()
    Else
        MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddCommentAnnot")
    End If
End Using
using (AnnotationManager annotationManager = new AnnotationManager())
{
    if ((annotationManager.InitFromFile("test.jpeg") == GdPictureStatus.OK) &&
        (annotationManager.PageCount > 0) && (annotationManager.SelectPage(1) == GdPictureStatus.OK))
    {
        int annotCount = annotationManager.GetAnnotationCount();
        GdPicture14.Annotations.Annotation annot = null;
        for (int a = 0; a < annotCount; a++)
        {
            annot = annotationManager.GetAnnotationFromIdx(a);
            if (annot != null)
            {
                GdPicture14.Annotations.Annotation.GdPictureAnnotationType type = annotationManager.GetAnnotationType(a);
                if (type == GdPicture14.Annotations.Annotation.GdPictureAnnotationType.AnnotationTypeRuler)
                {
                    GdPicture14.Annotations.AnnotationComment comment = annotationManager.AddCommentAnnot(annot.Guid, annot.Left, annot.Top, 1, 1);
                    if (comment != null)
                    {
                        comment.Text = "To be customized.";
                    }
                }
            }
        }
        if ((annotationManager.SaveAnnotationsToPage() == GdPictureStatus.OK) &&
            (annotationManager.SaveDocumentToJPEG("test_reviewed.jpeg", 75) == GdPictureStatus.OK))
            MessageBox.Show("Done!", "AnnotationManager.AddCommentAnnot");
        else
            MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddCommentAnnot");
        annotationManager.Close();
    }
    else
        MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.AddCommentAnnot");
}
See Also