Reference Guide
GdPicture14 Namespace / GdViewer Class / GetPageTextArea Method / GetPageTextArea(Single,Single,Single,Single) Method
The horizontal (X) coordinate of the top left point of the required rectangle, in inches.
The vertical (Y) coordinate of the top left point of the required rectangle, in inches.
The width of the required rectangle, in inches.
The height of the required rectangle, in inches.
Example





In This Topic
    GetPageTextArea(Single,Single,Single,Single) Method
    In This Topic
    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.

    Syntax
    'Declaration
     
    
    Public Overloads Function GetPageTextArea( _
       ByVal Left As Single, _
       ByVal Top As Single, _
       ByVal Width As Single, _
       ByVal Height As Single _
    ) As String
    public string GetPageTextArea( 
       float Left,
       float Top,
       float Width,
       float Height
    )
    public function GetPageTextArea( 
        Left: Single;
        Top: Single;
        Width: Single;
        Height: Single
    ): String; 
    public function GetPageTextArea( 
       Left : float,
       Top : float,
       Width : float,
       Height : float
    ) : String;
    public: string* GetPageTextArea( 
       float Left,
       float Top,
       float Width,
       float Height
    ) 
    public:
    String^ GetPageTextArea( 
       float Left,
       float Top,
       float Width,
       float Height
    ) 

    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. Please always use the GetStat method to determine if this method has been successful.
    Remarks
    Please note that this method is only useful for text-based document formats, like DOCX, TXT, RTF and PDF, otherwise it returns an empty string.
    Example
    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");
    See Also