Dim caption As String = "Example: AddImageFromBitmap"
Dim gdpictureImaging As New GdPictureImaging()
Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromFile("image1.tif")
If gdpictureImaging.GetStat() = GdPictureStatus.OK Then
Dim bitmap As Bitmap = gdpictureImaging.GetBitmapFromGdPictureImage(imageID)
If gdpictureImaging.GetStat() = GdPictureStatus.OK Then
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.NewPDF() = GdPictureStatus.OK Then
Dim imageResName As String = gdpicturePDF.AddImageFromBitmap(bitmap, False, True)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
If gdpicturePDF.SaveToFile("test_AddImageFromBitmap.pdf", True) = GdPictureStatus.OK Then
MessageBox.Show("The example has been followed successfully and the file has been saved.", caption)
Else
MessageBox.Show("The file can't be saved. Status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The AddImageFromBitmap() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The NewPDF() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
gdpicturePDF.Dispose()
Else
MessageBox.Show("The GetBitmapFromGdPictureImage() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption)
End If
gdpictureImaging.ReleaseGdPictureImage(imageID)
Else
MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption)
End If
gdpictureImaging.Dispose()
string caption = "Example: AddImageFromBitmap";
GdPictureImaging gdpictureImaging = new GdPictureImaging();
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.tif");
if (gdpictureImaging.GetStat() == GdPictureStatus.OK)
{
Bitmap bitmap = gdpictureImaging.GetBitmapFromGdPictureImage(imageID);
if (gdpictureImaging.GetStat() == GdPictureStatus.OK)
{
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.NewPDF() == GdPictureStatus.OK)
{
string imageResName = gdpicturePDF.AddImageFromBitmap(bitmap, false, true);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
if (gdpicturePDF.SaveToFile("test_AddImageFromBitmap.pdf", true) == GdPictureStatus.OK)
MessageBox.Show("The example has been followed successfully and the file has been saved.", caption);
else
MessageBox.Show("The file can't be saved. Status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
MessageBox.Show("The AddImageFromBitmap() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
MessageBox.Show("The NewPDF() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
gdpicturePDF.Dispose();
}
else
MessageBox.Show("The GetBitmapFromGdPictureImage() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
else
MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption);
gdpictureImaging.Dispose();