'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
'Enabling text selection.
GdViewer1.EnableTextSelection = True
If GdViewer1.SelectAllText() = GdPictureStatus.OK Then
Dim regions As RectangleF() = GdViewer1.GetSelectedTextRegions()
If GdViewer1.GetStat() = GdPictureStatus.OK Then
MessageBox.Show("The number of selected text regions is: " + regions.Count().ToString(), "GdViewer.GetSelectedTextRegions")
'Selecting the first region, if any exists.
If regions.Count() > 0 Then
'The first region surely exists.
Dim rect As RectangleF = regions.ElementAt(0)
GdViewer1.SetRectCoordinatesOnDocumentInches(rect.Left, rect.Top, rect.Width, rect.Height)
GdViewer1.CenterOnRect()
End If
GdViewer1.ClearSelectedText()
Else
MessageBox.Show("The text can't be extracted. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetSelectedTextRegions")
End If
Else
MessageBox.Show("The text can't be selected. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetSelectedTextRegions")
End If
Else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetSelectedTextRegions")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
//Enabling text selection.
GdViewer1.EnableTextSelection = true;
if (GdViewer1.SelectAllText() == GdPictureStatus.OK)
{
RectangleF[] regions = GdViewer1.GetSelectedTextRegions();
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
MessageBox.Show("The number of selected text regions is: " + regions.Count().ToString(), "GdViewer.GetSelectedTextRegions");
//Selecting the first region, if any exists.
if (regions.Count() > 0)
{
//The first region surely exists.
RectangleF rect = regions.ElementAt(0);
GdViewer1.SetRectCoordinatesOnDocumentInches(rect.Left, rect.Top, rect.Width, rect.Height);
GdViewer1.CenterOnRect();
}
GdViewer1.ClearSelectedText();
}
else
MessageBox.Show("The text can't be extracted. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetSelectedTextRegions");
}
else
MessageBox.Show("The text can't be selected. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetSelectedTextRegions");
}
else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetSelectedTextRegions");