DisplayPage Method (GdViewer)
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 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
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.
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);
}
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