Dim caption As String = "Example: GetPageImageCount"
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
Dim pageCount As Integer = gdpicturePDF.GetPageCount()
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
If (status = GdPictureStatus.OK) AndAlso (pageCount > 0) Then
Dim message As String = ""
Dim imageCount As Integer = 0
For i As Integer = 1 To pageCount
status = gdpicturePDF.SelectPage(i)
If status = GdPictureStatus.OK Then
imageCount = gdpicturePDF.GetPageImageCount()
If status = GdPictureStatus.OK Then
message = message + "The page nr." + i.ToString() + " contains " + imageCount.ToString() + " images." + vbCrLf
Else
message = message + "The GetPageImageCount() method has failed for the page nr. " + i.ToString() + " with the status: " + status.ToString() + vbCrLf
End If
Else
MessageBox.Show("The SelectPage() method has failed for the page number " + i.ToString() + " with the status: " + status.ToString(), caption)
Exit For
End If
Next
MessageBox.Show(message, caption)
Else
If (status = GdPictureStatus.OK) Then
MessageBox.Show("This file doesn't contain any page.", caption)
Else
MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), caption)
End If
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetPageImageCount";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
int pageCount = gdpicturePDF.GetPageCount();
GdPictureStatus status = gdpicturePDF.GetStat();
if ((status == GdPictureStatus.OK) && (pageCount > 0))
{
string message = "";
int imageCount = 0;
for (int i = 1; i <= pageCount; i++)
{
status = gdpicturePDF.SelectPage(i);
if (status == GdPictureStatus.OK)
{
imageCount = gdpicturePDF.GetPageImageCount();
if (status == GdPictureStatus.OK)
{
message = message + "The page nr." + i.ToString() + " contains " + imageCount.ToString() + " images.\n";
}
else
{
message = message + "The GetPageImageCount() method has failed for the page nr. " + i.ToString() + " with the status: " + status.ToString() + "\n";
}
}
else
{
MessageBox.Show("The SelectPage() method has failed for the page number " + i.ToString() + " with the status: " + status.ToString(), caption);
break;
}
}
MessageBox.Show(message, caption);
}
else
{
if (status == GdPictureStatus.OK)
MessageBox.Show("This file doesn't contain any page.", 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();