AddCommentAnnot Method (AnnotationManager)
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.
public function AddCommentAnnot(
: String;
: Single;
: Single;
: Single;
: Single
): AnnotationComment;
public function AddCommentAnnot(
: String,
: float,
: float,
: float,
: float
) : AnnotationComment;
'Declaration
Public Function AddCommentAnnot( _
ByVal As String, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single _
) As AnnotationComment
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.
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");
}