'We assume that the GdViewer1 control has been integrated into your application.
If GdViewer1.DisplayFromFile("text_to_search.txt") = GdPictureStatus.OK Then
Dim annotMgr As AnnotationManager = GdViewer1.GetAnnotationManager()
If (annotMgr IsNot Nothing) AndAlso (annotMgr.SelectPage(1) = GdPictureStatus.OK) Then
Dim text_to_find As String = "GdPicture"
Dim occurrence As Integer = 1
Dim left As Single = 0, top As Single = 0, width As Single = 0, height As Single = 0
Dim text_found As Boolean = False
GdViewer1.RemoveAllRegions()
While GdViewer1.SearchText(GdViewer1.CurrentPage, text_to_find, occurrence, True, left, top, width, height)
text_found = True
Dim annotLine As GdPicture14.Annotations.AnnotationLine = annotMgr.AddLineAnnot(Color.Blue, left, top + height, left + width, top + height)
If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annotLine IsNot Nothing) Then
annotLine.Author = "GdPicture"
annotLine.BorderWidth = 0.05F
annotLine.Tag = "Line"
End If
annotLine.Dispose()
occurrence = occurrence + 1
End While
If text_found Then
If (annotMgr.SaveAnnotationsToPage() <> GdPictureStatus.OK) OrElse
(annotMgr.BurnAnnotationsToPage(True) <> GdPictureStatus.OK) OrElse
(annotMgr.SaveDocumentToJPEG("text_lines.jpg", 75) <> GdPictureStatus.OK) Then
MessageBox.Show("An error occurred when saving the file. Status: " + annotMgr.GetStat().ToString(), "AnnotationManager.AddLineAnnot")
End If
GdViewer1.Redraw()
Else
MessageBox.Show("The given text has not been found.", "AnnotationManager.AddLineAnnot")
End If
Else
MessageBox.Show("The AnnotationManager can't be initialized.", "AnnotationManager.AddLineAnnot")
End If
Else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "AnnotationManager.AddLineAnnot")
End If
//We assume that the GdViewer1 control has been integrated into your application.
if (GdViewer1.DisplayFromFile("text_to_search.txt") == GdPictureStatus.OK)
{
AnnotationManager annotMgr = GdViewer1.GetAnnotationManager();
if ((annotMgr != null) && (annotMgr.SelectPage(1) == GdPictureStatus.OK))
{
string text_to_find = "GdPicture";
int occurrence = 1;
float left = 0, top = 0, width = 0, height = 0;
bool text_found = false;
GdViewer1.RemoveAllRegions();
while (GdViewer1.SearchText(GdViewer1.CurrentPage, text_to_find, occurrence, true, ref left, ref top, ref width, ref height))
{
text_found = true;
GdPicture14.Annotations.AnnotationLine annotLine = annotMgr.AddLineAnnot(Color.Blue, left, top+height, left+width, top+height);
if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annotLine != null))
{
annotLine.Author = "GdPicture";
annotLine.BorderWidth = 0.05f;
annotLine.Tag = "Line";
}
annotLine.Dispose();
occurrence = occurrence + 1;
}
if (text_found)
{
if ((annotMgr.SaveAnnotationsToPage() != GdPictureStatus.OK) ||
(annotMgr.BurnAnnotationsToPage(true) != GdPictureStatus.OK) ||
(annotMgr.SaveDocumentToJPEG("text_lines.jpg", 75) != GdPictureStatus.OK))
MessageBox.Show("An error occurred when saving the file. Status: " + annotMgr.GetStat().ToString(), "AnnotationManager.AddLineAnnot");
GdViewer1.Redraw();
}
else
MessageBox.Show("The given text has not been found.", "AnnotationManager.AddLineAnnot");
}
else
MessageBox.Show("The AnnotationManager can't be initialized.", "AnnotationManager.AddLineAnnot");
}
else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "AnnotationManager.AddLineAnnot");