GdPicture.NET.14
GdPicture14 Namespace / AnnotationManager Class / SelectPage Method
The required page number. It must be a value from 1 to the value of the PageCount property.
Example





In This Topic
SelectPage Method (AnnotationManager)
In This Topic
Selects the page to be operated further in the document currently handled by this AnnotationManager object. It is always necessary to select the required page before handling the document.
Syntax
'Declaration
 
Public Function SelectPage( _
   ByVal PageNo As Integer _
) As GdPictureStatus
public GdPictureStatus SelectPage( 
   int PageNo
)
public function SelectPage( 
    PageNo: Integer
): GdPictureStatus; 
public function SelectPage( 
   PageNo : int
) : GdPictureStatus;
public: GdPictureStatus SelectPage( 
   int PageNo
) 
public:
GdPictureStatus SelectPage( 
   int PageNo
) 

Parameters

PageNo
The required page number. It must be a value from 1 to the value of the PageCount property.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. We strongly recommend always checking this status first.
Remarks
Please ensure that you have selected the proper page before starting any page related action with the handled document.
Example
How to select a required page in a handled document.
Using annotationManager As AnnotationManager = New AnnotationManager()
    If annotationManager.InitFromFile("test.pdf") = GdPictureStatus.OK Then
        Dim message As String = "The number of pages: " + annotationManager.PageCount
        For p As Integer = 1 To annotationManager.PageCount - 1
            If annotationManager.SelectPage(p) = GdPictureStatus.OK Then
                Dim annotCount As Integer = annotationManager.GetAnnotationCount()
                If annotationManager.GetStat() = GdPictureStatus.OK Then
                    message = message + vbCrLf + "The page nr." + p + " contains " + annotCount.ToString() + " annotations."
                Else
                    MessageBox.Show("The GetAnnotationCount() method has failed with the status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SelectPage")
                    Exit For
                End If
            Else
                MessageBox.Show("The SelectPage() method has failed with the status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SelectPage")
                Exit For
            End If
        Next
        If annotationManager.GetStat() = GdPictureStatus.OK Then MessageBox.Show(message, "AnnotationManager.SelectPage")
        annotationManager.Close()
    Else
        MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SelectPage")
    End If
End Using
using (AnnotationManager annotationManager = new AnnotationManager())
{
    if (annotationManager.InitFromFile("test.pdf") == GdPictureStatus.OK)
    {
        string message = "The number of pages: " + annotationManager.PageCount;
        for (int p = 1; p < annotationManager.PageCount; p++)
        {
            if (annotationManager.SelectPage(p) == GdPictureStatus.OK)
            {
                int annotCount = annotationManager.GetAnnotationCount();
                if (annotationManager.GetStat() == GdPictureStatus.OK)
                {
                    message = message + "\nThe page nr." + p + " contains " + annotCount.ToString() + " annotations.";
                }
                else
                {
                    MessageBox.Show("The GetAnnotationCount() method has failed with the status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SelectPage");
                    break;
                }
            }
            else
            {
                MessageBox.Show("The SelectPage() method has failed with the status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SelectPage");
                break;
            }
        }
        if (annotationManager.GetStat() == GdPictureStatus.OK)
            MessageBox.Show(message, "AnnotationManager.SelectPage");
        annotationManager.Close();
    }
    else
        MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SelectPage");
}
See Also