In This Topic
Returns if the currently selected page of the loaded PDF is entirely image-based.
Image-based pages are considered to contain nothing but one fully visible image covering the whole page area. This image must not be in any way rotated and must not contain any other particular drawing operation such as a clipping path.
Be aware that this method does not ignore the hidden text if present. It is the same as what the IsPageImage(false) method does.
Syntax
'Declaration
Public Overloads Function IsPageImage() As Boolean
public bool IsPageImage()
public function IsPageImage(): Boolean;
public function IsPageImage() : boolean;
public: bool IsPageImage();
public:
bool IsPageImage();
Return Value
true if the currently selected page is entirely image-based as defined above, otherwise false. The
GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.
Example
How to find out if pages in the PDF document are image-based or not.
Dim caption As String = "Example: IsPageImage"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("image.pdf", False)
If status = GdPictureStatus.OK Then
Dim pageCount As Integer = gdpicturePDF.GetPageCount()
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
Dim result As Boolean = False
For i As Integer = 1 To pageCount
status = gdpicturePDF.SelectPage(i)
If status = GdPictureStatus.OK Then
result = gdpicturePDF.IsPageImage()
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If result Then
MessageBox.Show("The page nr." + i.ToString() + " IS image-based.", caption)
Else
MessageBox.Show("The page nr." + i.ToString() + " IS NOT image-based.", caption)
End If
Else
MessageBox.Show("The IsPageImage() 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
MessageBox.Show("Finished successfully.", caption)
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
gdpicturePDF.Dispose()
string caption = "Example: IsPageImage";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("image.pdf", false);
if (status == GdPictureStatus.OK)
{
int pageCount = gdpicturePDF.GetPageCount();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
bool result = false;
for (int i = 1; i <= pageCount; i++)
{
status = gdpicturePDF.SelectPage(i);
if (status == GdPictureStatus.OK)
{
result = gdpicturePDF.IsPageImage();
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (result)
{
MessageBox.Show("The page nr." + i.ToString() + " IS image-based.", caption);
}
else
{
MessageBox.Show("The page nr." + i.ToString() + " IS NOT image-based.", caption);
}
}
else
{
MessageBox.Show("The IsPageImage() method has failed with the status: " + status.ToString(), caption);
}
}
else
{
MessageBox.Show("The SelectPage() method has failed with the status: " + status.ToString(), caption);
}
}
MessageBox.Show("Finished successfully.", 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);
}
gdpicturePDF.Dispose();
Example
How to find out if pages in the PDF document are image-based or not.
Dim caption As String = "Example: IsPageImage"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("image.pdf", False)
If status = GdPictureStatus.OK Then
Dim pageCount As Integer = gdpicturePDF.GetPageCount()
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
Dim result As Boolean = False
For i As Integer = 1 To pageCount
status = gdpicturePDF.SelectPage(i)
If status = GdPictureStatus.OK Then
result = gdpicturePDF.IsPageImage()
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If result Then
MessageBox.Show("The page nr." + i.ToString() + " IS image-based.", caption)
Else
MessageBox.Show("The page nr." + i.ToString() + " IS NOT image-based.", caption)
End If
Else
MessageBox.Show("The IsPageImage() 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
MessageBox.Show("Finished successfully.", caption)
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
gdpicturePDF.Dispose()
string caption = "Example: IsPageImage";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("image.pdf", false);
if (status == GdPictureStatus.OK)
{
int pageCount = gdpicturePDF.GetPageCount();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
bool result = false;
for (int i = 1; i <= pageCount; i++)
{
status = gdpicturePDF.SelectPage(i);
if (status == GdPictureStatus.OK)
{
result = gdpicturePDF.IsPageImage();
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (result)
{
MessageBox.Show("The page nr." + i.ToString() + " IS image-based.", caption);
}
else
{
MessageBox.Show("The page nr." + i.ToString() + " IS NOT image-based.", caption);
}
}
else
{
MessageBox.Show("The IsPageImage() method has failed with the status: " + status.ToString(), caption);
}
}
else
{
MessageBox.Show("The SelectPage() method has failed with the status: " + status.ToString(), caption);
}
}
MessageBox.Show("Finished successfully.", 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);
}
gdpicturePDF.Dispose();
See Also