DisplayPage Method (GdViewer)
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
GdViewer.CurrentPage property is changed to the specified page number as well.
The GdViewer.PageDisplayed and the GdViewer.PageChanged events are raised after the page has been successfully displayed and changed.
Be aware that the GdViewer.SaveAnnotationsToPage method is called internally before each page change.
'Declaration
Public Function DisplayPage( _
ByVal As Integer _
) As GdPictureStatus
Parameters
- Page
- The required page number. It must be a value from 1 to the value of the GdViewer.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.
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);
}