You are here: GdPicture.NET > Documentation > Classes > GdViewer Class > GdViewer Methods > PDF Features > PdfSearchText > PdfSearchText Method (String, Integer, Boolean)
logo.gif
ContentsIndexHome
PreviousUpNext
GdViewer.PdfSearchText Method (String, Integer, Boolean)

Searches the current page of the displayed PDF for a given text string.

C#
public Boolean PdfSearchText(
    String Text, 
    int Occurrence, 
    Boolean CaseSensitive
);
Visual Basic
Public Function PdfSearchText(
    ByVal Text As String, 
    ByVal Occurrence As Integer, 
    ByVal CaseSensitive As Boolean
) As Boolean
Parameters
Parameters 
Description 
Text 
The text to search for.  
Occurrence 
Optional. The occurrence of the text to search for. 0 to search and highlight all occurrences found else 1 to search for the first occurrence, 2 for the second...
If you specify a value different of 0 the area covered by the occurrence found is made the current selection.  
CaseSensitive 
True to apply case-sensitive search, else False.  
Returns

True if the string has been found, else False.

Searches the current page for a string and highlight the result

Dim Text As String = InputBox("Search...")
Dim Occurrence As Integer = 1
Dim Left, Top, Width, Height As Single
Dim TextFound As Boolean = False
 
GdViewer1.RemoveAllRegions()
While GdViewer1.PdfSearchText(GdViewer1.CurrentPage, Text, Occurrence, False, Left, Top, Width, Height)
    TextFound = True
    GdViewer1.AddRegionInches("Region" & Str(Occurrence), Left, Top, Width, Height, ForegroundMixMode.ForegroundMixModeMASKPEN, GdViewer1.ARGB(255, 255, 255, 0))
    Occurrence = Occurrence + 1
End While
If TextFound Then
    GdViewer1.Redraw()
Else
    MsgBox("Not found !")
End If
What do you think about this topic? Send feedback!
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.