The 0-based index of the required annotation within the selected page of the handled document. It must be a value from 0 to AnnotationManager.GetAnnotationCount-1.
The name of a required annotation property as a string, for example, "FillColor".
Example





In This Topic
GdPicture14 Namespace / AnnotationManager Class / GetAnnotationPropertyValue Method

GetAnnotationPropertyValue Method (AnnotationManager)

In This Topic
Returns the current value of a required annotation property of a GdPicture/XMP annotation object specified by its index related to the selected page of the document currently handled by this AnnotationManager object.

This method has been initially introduced for the COM interop edition. Please refer to the Annotations Namespace for the .NET edition to determine available annotation properties and explore them for each particular class. All annotations classes share their properties from the main Annotation class and add their own properties to the individual classes according to the annotation type.

Be aware that this method only handles GdPicture/XMP annotations. Likewise, annotations are always treated relative to the selected page.

Syntax
'Declaration

 

Public Function GetAnnotationPropertyValue( _

   ByVal AnnotationIdx As Integer, _

   ByVal Name As String _

) As Object
public object GetAnnotationPropertyValue( 

   int AnnotationIdx,

   string Name

)
public function GetAnnotationPropertyValue( 

    AnnotationIdx: Integer;

    Name: String

): TObject; 
public function GetAnnotationPropertyValue( 

   AnnotationIdx : int,

   Name : String

) : Object;
public: Object* GetAnnotationPropertyValue( 

   int AnnotationIdx,

   string* Name

) 
public:

Object^ GetAnnotationPropertyValue( 

   int AnnotationIdx,

   String^ Name

) 

Parameters

AnnotationIdx
The 0-based index of the required annotation within the selected page of the handled document. It must be a value from 0 to AnnotationManager.GetAnnotationCount-1.
Name
The name of a required annotation property as a string, for example, "FillColor".

Return Value

The value of the specified property or an empty object. The AnnotationManager.GetStat method can be subsequently used to determine if this method has been successful.
Remarks
It is recommend to use the AnnotationManager.GetStat method to identify the specific reason for the method's failure, if any.

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. At the same, be aware that the method only handles GdPicture/XMP annotations.

Example
How to get the value of the required property of the specified annotation.
Using annotationManager As AnnotationManager = New AnnotationManager()

    If annotationManager.InitFromFile("source.pdf") = GdPictureStatus.OK Then

        For p As Integer = 1 To annotationManager.PageCount

            If annotationManager.SelectPage(p) = GdPictureStatus.OK Then

                Dim annotCount As Integer = annotationManager.GetAnnotationCount()

                If annotationManager.GetStat() = GdPictureStatus.OK Then

                    For a As Integer = 0 To annotCount - 1

                        Dim value As Object = annotationManager.GetAnnotationPropertyValue(a, "Tag")

                        Dim tagValue As String = ""

                        If value IsNot Nothing Then

                            tagValue = CStr(value)

                            If tagValue.Equals("delete") Then

                                If annotationManager.DeleteAnnotation(a) <> GdPictureStatus.OK Then Exit For

                            Else

                                tagValue += " checked"

                                value = CObj(tagValue)

                                If annotationManager.SetAnnotationPropertyValue(a, "Tag", value) <> GdPictureStatus.OK Then Exit For

                            End If

                        End If

                    Next

                    If annotationManager.GetStat() = GdPictureStatus.OK Then annotationManager.SaveAnnotationsToPage()

                    If annotationManager.GetStat() <> GdPictureStatus.OK Then Exit For

                Else

                    Exit For

                End If

            Else

                Exit For

            End If

        Next

        If annotationManager.GetStat() = GdPictureStatus.OK Then

            If annotationManager.SaveDocumentToPDF("dest.pdf") = GdPictureStatus.OK Then

                MessageBox.Show("Done!", "AnnotationManager.GetAnnotationPropertyValue")

            Else

                MessageBox.Show("The document can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationPropertyValue")

            End If

        Else

            MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationPropertyValue")

        End If

        annotationManager.Close()

    Else

        MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationType")

    End If

End Using
using (AnnotationManager annotationManager = new AnnotationManager())

{

    if (annotationManager.InitFromFile("source.pdf") == GdPictureStatus.OK)

    {

        for (int p = 1; p <= annotationManager.PageCount; p++)

        {

            if (annotationManager.SelectPage(p) == GdPictureStatus.OK)

            {

                int annotCount = annotationManager.GetAnnotationCount();

                if (annotationManager.GetStat() == GdPictureStatus.OK)

                {

                    for (int a = 0; a < annotCount; a++)

                    {

                        object value = annotationManager.GetAnnotationPropertyValue(a, "Tag");

                        string tagValue = "";

                        if (value != null)

                        {

                            tagValue = (string)value;

                            if (tagValue.Equals("delete"))

                            {

                                if (annotationManager.DeleteAnnotation(a) != GdPictureStatus.OK) break;

                            }

                            else

                            {

                                tagValue += " checked";

                                value = (object)tagValue;

                                if (annotationManager.SetAnnotationPropertyValue(a, "Tag", value) != GdPictureStatus.OK) break;

                            }

                        }

                    }

                    if (annotationManager.GetStat() == GdPictureStatus.OK)

                        annotationManager.SaveAnnotationsToPage();

                    if (annotationManager.GetStat() != GdPictureStatus.OK) break;

                }

                else break;

            }

            else break;

        }

        if (annotationManager.GetStat() == GdPictureStatus.OK)

        {

            if (annotationManager.SaveDocumentToPDF("dest.pdf") == GdPictureStatus.OK)

                MessageBox.Show("Done!", "AnnotationManager.GetAnnotationPropertyValue");

            else

                MessageBox.Show("The document can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationPropertyValue");

        }

        else

            MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationPropertyValue");

        annotationManager.Close();

    }

    else

        MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationType");

}
See Also