Dim caption As String = "Example: IsPageImage"
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("drawing.pdf", False)
If status = GdPictureStatus.OK Then
status = gdpicturePDF.SelectPage(1)
If status = GdPictureStatus.OK Then
Dim imageID As Integer = 0
Dim result As Boolean = gdpicturePDF.IsPageImage(imageID, True)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If result Then
Dim name As String = gdpicturePDF.AddImageFromGdPictureImage(imageID, False, True)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If gdpicturePDF.SaveToFile("drawing_duplicated.pdf") = GdPictureStatus.OK Then
MessageBox.Show("The image has been successfully duplicated.", caption)
End If
Else
MessageBox.Show("The AddImageFromGdPictureImage() method has failed with the status: " + status.ToString(), caption)
End If
GdPictureDocumentUtilities.DisposeImage(imageID)
Else
MessageBox.Show("This page 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
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("drawing.pdf", false);
if (status == GdPictureStatus.OK)
{
status = gdpicturePDF.SelectPage(1);
if (status == GdPictureStatus.OK)
{
int imageID = 0;
bool result = gdpicturePDF.IsPageImage(ref imageID, true);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (result)
{
string name = gdpicturePDF.AddImageFromGdPictureImage(imageID, false, true);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (gdpicturePDF.SaveToFile("drawing_duplicated.pdf") == GdPictureStatus.OK)
MessageBox.Show("The image has been successfully duplicated.", caption);
}
else
{
MessageBox.Show("The AddImageFromGdPictureImage() method has failed with the status: " + status.ToString(), caption);
}
GdPictureDocumentUtilities.DisposeImage(imageID);
}
else
MessageBox.Show("This page 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);
}
else
MessageBox.Show("The file can't be loaded.", caption);
gdpicturePDF.Dispose();