Reference Guide
GdPicture14.WPF Namespace / GdViewer Class / DisplayPage(Int32) Method
The required page number. It must be a value from 1 to the value of the PageCount property.
Example





In This Topic
    DisplayPage(Int32) Method
    In This Topic
    Changes the displayed page to the specified one, if that is available, of the document currently loaded in the GdViewer control. The value of the CurrentPage property is changed to the specified page number as well.

    The PageDisplayed and the PageChanged events, respectively the PreviewPageDisplayed and the PreviewPageChanged events, are raised after the page has been successfully displayed and changed.

    Be aware that the SaveAnnotationsToPage method is called internally before each page change.

    Syntax
    'Declaration
     
    
    Public Function DisplayPage( _
       ByVal Page As Integer _
    ) As GdPictureStatus
    public GdPictureStatus DisplayPage( 
       int Page
    )
    public function DisplayPage( 
        Page: Integer
    ): GdPictureStatus; 
    public function DisplayPage( 
       Page : int
    ) : GdPictureStatus;
    public: GdPictureStatus DisplayPage( 
       int Page
    ) 
    public:
    GdPictureStatus DisplayPage( 
       int Page
    ) 

    Parameters

    Page
    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
    This method changes the value of the CurrentPage property to the specified page number.

    Just to remind you that both the PageDisplayed and the PageChanged events, respectively the PreviewPageDisplayed and the PreviewPageChanged events, are raised using this method.

    Example
    How to display the page with the found text.
    'We assume that the GdViewer1 control has been properly integrated
    'and your document has been properly displayed as well.
    Sub MySearchText(ByVal TextToSearch As String)
        Dim page As Integer = GdViewer1.CurrentPage, occurrence As Integer = 0
        Dim status As GdPictureStatus = GdPictureStatus.OK
        While (status = GdPictureStatus.OK) AndAlso (page <= GdViewer1.PageCount)
            occurrence = GdViewer1.GetTextOccurrenceCount(page, TextToSearch, False, False)
            status = GdViewer1.GetStat()
            If status = GdPictureStatus.OK Then
                If occurrence > 0 Then Exit While
                page += 1
            End If
        End While
        If (status = GdPictureStatus.OK) AndAlso (occurrence > 0) Then GdViewer1.DisplayPage(page)
    End Sub
    //We assume that the GdViewer1 control has been properly integrated
    //and your document has been properly displayed as well.
    void MySearchText(string TextToSearch)
    {
        int page = GdViewer1.CurrentPage, occurrence = 0;
        GdPictureStatus status = GdPictureStatus.OK;
        while ((status == GdPictureStatus.OK) && (page <= GdViewer1.PageCount))
        {
            occurrence = GdViewer1.GetTextOccurrenceCount(page, TextToSearch, false, false);
            status = GdViewer1.GetStat();
            if (status == GdPictureStatus.OK)
            {
                if (occurrence > 0) break;
                page++;
            }
        }
        if ((status == GdPictureStatus.OK) && (occurrence > 0))
            GdViewer1.DisplayPage(page);
    }
    See Also