GetOrderedAnnotations Method (AnnotationManager)
                                 
                                
                                    
                                        In This Topic
                                    
                                
                                Returns an array of GdPicture/XMP annotations, sorted by their Z-order, which are contained on the selected page of the document currently handled by this AnnotationManager object.
Be aware that this method only handles GdPicture/XMP annotations. Likewise, annotations are always treated relative to the selected page.
 
            
            
            Syntax
            
        
            
            
            Return Value
An array of sorted Annotation objects by their Z-order contained on the currently selected page.
 
            
            
            
            
            
            Example
How to get the annotations contained on the current page sorted by their Z-order.
            
             
    
	
		Using annotationManager As AnnotationManager = New AnnotationManager()
    If (annotationManager.InitFromFile("annots.jpeg") = GdPictureStatus.OK) AndAlso
       (annotationManager.PageCount > 0) AndAlso (annotationManager.SelectPage(1) = GdPictureStatus.OK) Then
        Dim message As String = "Done!" + vbCrLf
        Dim annots As GdPicture14.Annotations.Annotation() = annotationManager.GetOrderedAnnotations()
        If annotationManager.GetStat() = GdPictureStatus.OK Then
            For i As Integer = 0 To annots.Count() - 1
                message += annots(i).GetType().ToString() + "  Z: " + annots(i).Zorder + vbCrLf
                'Or you can change the annotations Z-order here as you need.
            Next
            MessageBox.Show(message, "AnnotationManager.GetOrderedAnnotations")
        Else
            MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetOrderedAnnotations")
        End If
    Else
        MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetOrderedAnnotations")
    End If
End Using
	 
	
		using (AnnotationManager annotationManager = new AnnotationManager())
{
    if ((annotationManager.InitFromFile("annots.jpeg") == GdPictureStatus.OK) &&
        (annotationManager.PageCount > 0) && (annotationManager.SelectPage(1) == GdPictureStatus.OK))
    {
        string message = "Done!\n";
        GdPicture14.Annotations.Annotation[] annots = annotationManager.GetOrderedAnnotations();
        if (annotationManager.GetStat() == GdPictureStatus.OK)
        {
            for (int i = 0; i < annots.Count(); i++)
            {
                message += annots[i].GetType() + "  Z: " + annots[i].Zorder + "\n";
                //Or you can change the annotations Z - order here as you need.
            }
            MessageBox.Show(message, "AnnotationManager.GetOrderedAnnotations");
        }
        else
            MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetOrderedAnnotations");
    }
    else
        MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetOrderedAnnotations");
}
	 
	
 
 
            
            Example
How to get the annotations contained on the current page sorted by their Z-order.
            
            Using annotationManager As AnnotationManager = New AnnotationManager()
                If (annotationManager.InitFromFile("annots.jpeg") = GdPictureStatus.OK) AndAlso
                   (annotationManager.PageCount > 0) AndAlso (annotationManager.SelectPage(1) = GdPictureStatus.OK) Then
                    Dim message As String = "Done!" + vbCrLf
                    Dim annots As GdPicture14.Annotations.Annotation() = annotationManager.GetOrderedAnnotations()
                    If annotationManager.GetStat() = GdPictureStatus.OK Then
                        For i As Integer = 0 To annots.Count() - 1
                            message += annots(i).GetType().ToString() + "  Z: " + annots(i).Zorder + vbCrLf
                            'Or you can change the annotations Z-order here as you need.
                        Next
                        MessageBox.Show(message, "AnnotationManager.GetOrderedAnnotations")
                    Else
                        MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetOrderedAnnotations")
                    End If
                Else
                    MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetOrderedAnnotations")
                End If
            End Using
            using (AnnotationManager annotationManager = new AnnotationManager())
            {
                if ((annotationManager.InitFromFile("annots.jpeg") == GdPictureStatus.OK) &&
                    (annotationManager.PageCount > 0) && (annotationManager.SelectPage(1) == GdPictureStatus.OK))
                {
                    string message = "Done!\n";
                    GdPicture14.Annotations.Annotation[] annots = annotationManager.GetOrderedAnnotations();
                    if (annotationManager.GetStat() == GdPictureStatus.OK)
                    {
                        for (int i = 0; i < annots.Count(); i++)
                        {
                            message += annots[i].GetType() + "  Z: " + annots[i].Zorder + "\n";
                            //Or you can change the annotations Z - order here as you need.
                        }
                        MessageBox.Show(message, "AnnotationManager.GetOrderedAnnotations");
                    }
                    else
                        MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetOrderedAnnotations");
                }
                else
                    MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetOrderedAnnotations");
            }
            
            
            See Also