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();