GdPicture.NET.14
GdPicture14.WPF Namespace / GdViewer Class / GetPageText Method / GetPageText() Method
Example





GetPageText() Method
Returns the whole text of the current page of the text-based document displayed in the GdViewer control. 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 GetPageText() As String
 

Return Value

The whole text 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.
Remarks
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 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.GetPageText()
    If GdViewer1.GetStat() = GdPictureStatus.OK Then
        If String.IsNullOrEmpty(page_text) Then
            MessageBox.Show("The current page does not contain text.", "GdViewer.GetPageText")
        Else
            'Do your stuff with the page_text.
        End If
    Else
        MessageBox.Show("The GetPageText() method has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetPageText")
    End If
Else
    MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetPageText")
End If
See Also