GetPageTextArea(Single,Single,Single,Single) Method
Returns the whole text, that is contained within a specific area of the current page of the text-based document displayed in the GdViewer control. You have to set the required page area as a rectangle defined by its top left coordinates and by its width and height in inches.
If the format of the displayed document is other than supported text-based formats, which currently are DOCX, TXT, RTF and PDF, this method returns an empty string.
public string GetPageTextArea(
float ,
float ,
float ,
float
)
public function GetPageTextArea(
: Single;
: Single;
: Single;
: Single
): String;
public function GetPageTextArea(
: float,
: float,
: float,
: float
) : String;
public: string* GetPageTextArea(
float ,
float ,
float ,
float
)
public:
String^ GetPageTextArea(
float ,
float ,
float ,
float
)
'Declaration
Public Overloads Function GetPageTextArea( _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single _
) As String
Parameters
- Left
- The horizontal (X) coordinate of the top left point of the required rectangle, in inches.
- Top
- The vertical (Y) coordinate of the top left point of the required rectangle, in inches.
- Width
- The width of the required rectangle, in inches.
- Height
- The height of the required rectangle, in inches.
Return Value
The text found within the defined area of the currently displayed page as a string, if the format of the displayed document is text-based. Otherwise, it returns an empty string. The
GetStat method can be subsequently used to determine if this method has been successful.
How to get the text of the given area on the current page of the displayed document.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
Dim page_text As String = GdViewer1.GetPageTextArea(10, 10, 50, 50)
If GdViewer1.GetStat() = GdPictureStatus.OK Then
If String.IsNullOrEmpty(page_text) Then
MessageBox.Show("The given area of the current page does not contain text.", "GdViewer.GetPageTextArea")
Else
'Do your stuff with the page_text.
End If
Else
MessageBox.Show("The GetPageText() method has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetPageTextArea")
End If
Else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetPageTextArea")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
string page_text = GdViewer1.GetPageTextArea(10, 10, 50, 50);
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
if (String.IsNullOrEmpty(page_text))
MessageBox.Show("The given area of the current page does not contain text.", "GdViewer.GetPageTextArea");
//else
//Do your stuff with the page_text.
}
else
MessageBox.Show("The GetPageText() method has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetPageTextArea");
}
else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetPageTextArea");