Specifies if the hidden text objects will be ignored. Hidden text is usually text with a text rendering mode which makes it invisible on the page.
Example





In This Topic

PageHasText(Boolean) Method

In This Topic
Returns if the currently selected page of the loaded PDF contains the visible text or also the hidden text according to the parameter you have specified. Please note that special characters like \r, \n, \l are always considered as text.

This method uses an internal algorithm which is faster than the full page text extraction.

Syntax
'Declaration
 
Public Overloads Function PageHasText( _
   ByVal IgnoreHiddenText As Boolean _
) As Boolean
public bool PageHasText( 
   bool IgnoreHiddenText
)
public function PageHasText( 
    IgnoreHiddenText: Boolean
): Boolean; 
public function PageHasText( 
   IgnoreHiddenText : boolean
) : boolean;
public: bool PageHasText( 
   bool IgnoreHiddenText
) 
public:
bool PageHasText( 
   bool IgnoreHiddenText
) 

Parameters

IgnoreHiddenText
Specifies if the hidden text objects will be ignored. Hidden text is usually text with a text rendering mode which makes it invisible on the page.

Return Value

true if the currently selected page contains text (visible and hidden according to your setting), otherwise false. The GetStat method can be subsequently used to determine if this method has been successful.
Remarks
This method is only allowed for use with non-encrypted documents.

It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

Example
How to find out if the current page in the PDF document contains also hidden text. The example shows you how to check all pages in the PDF document if they contain text and if the text is visible or only hidden.
Dim caption As String = "Example: PageHasText"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
    Dim pageCount As Integer = gdpicturePDF.GetPageCount()
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        Dim result As Boolean = False
        Dim message As String = ""
        For i As Integer = 1 To pageCount
            result = False
            message = ""
            status = gdpicturePDF.SelectPage(i)
            If status = GdPictureStatus.OK Then
                'Searching for both text - visible and hidden.
                result = gdpicturePDF.PageHasText(False)
                status = gdpicturePDF.GetStat()
                If status = GdPictureStatus.OK Then
                    message = "The page nr." + i.ToString()
                    If result Then ' the current page has text (visible or hidden)
                        'The hidden text will be ignored.
                        result = gdpicturePDF.PageHasText(True)
                        status = gdpicturePDF.GetStat()
                        If status = GdPictureStatus.OK Then
                            If result Then
                            'The current page has visible text.
                                message = message + " HAS text and HAS also VISIBLE text."
                            Else
                                'The current page has no visible text.
                                message = message + " HAS only HIDDEN text."
                            End If
                            MessageBox.Show(message, caption)
                        Else
                            MessageBox.Show("The PageHasText() method has failed with the status: " + status.ToString(), caption)
                        End If
                    Else
                        'Neither visible nor hidden text.
                        message = message + " HAS NO text."
                        MessageBox.Show(message, caption)
                    End If
                Else
                    MessageBox.Show("The PageHasText() method has failed with the status: " + status.ToString(), caption)
                End If
            Else
                MessageBox.Show("The SelectPage() method has failed with the status: " + status.ToString(), caption)
            End If
        Next
    Else
        MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), caption)
    End If
Else
    MessageBox.Show("The file can't be loaded.", caption)
End If
MessageBox.Show("Finished searching the document.", caption)
gdpicturePDF.Dispose()
string caption = "Example: PageHasText";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
    int pageCount = gdpicturePDF.GetPageCount();
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        bool result = false;
        string message = "";
        for (int i = 1; i <= pageCount; i++)
        {
            result = false; message = "";
            status = gdpicturePDF.SelectPage(i);
            if (status == GdPictureStatus.OK)
            {
                //Searching for both text - visible and hidden.
                result = gdpicturePDF.PageHasText(false);
                status = gdpicturePDF.GetStat();
                if (status == GdPictureStatus.OK)
                {
                    message = "The page nr." + i.ToString();
                    if (result)
                    {
                    //The current page has text (visible or hidden).
                        result = gdpicturePDF.PageHasText(true);
                        //The hidden text will be ignored.
                        status = gdpicturePDF.GetStat();
                        if (status == GdPictureStatus.OK)
                        {
                            if (result)
                            {
                                //The current page has visible text.
                                message = message + " HAS text and HAS also VISIBLE text.";
                            }
                            else
                            {
                                //The current page has no visible text.
                                message = message + " HAS only HIDDEN text.";
                            }
                            MessageBox.Show(message, caption);
                        }
                        else
                        {
                            MessageBox.Show("The PageHasText() method has failed with the status: " + status.ToString(), caption);
                        }
                    }
                    else
                    {
                        //Neither visible nor hidden text.
                        message = message + " HAS NO text.";
                        MessageBox.Show(message, caption);
                    }
                }
                else
                {
                    MessageBox.Show("The PageHasText() method has failed with the status: " + status.ToString(), caption);
                }
            }
            else
            {
                MessageBox.Show("The SelectPage() method has failed with the status: " + status.ToString(), caption);
            }
        }
    }
    else
    {
        MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), caption);
    }
}
else
{
    MessageBox.Show("The file can't be loaded.", caption);
}
MessageBox.Show("Finished searching the document.", caption);
gdpicturePDF.Dispose();
See Also