Dim caption As String = "Example: AddImageFromGdPictureImage"
Dim gdpictureImaging As New GdPictureImaging()
Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromFile("multi_image.tif")
If gdpictureImaging.GetStat() = GdPictureStatus.OK Then
Dim count As Integer = gdpictureImaging.GetPageCount(imageID)
If gdpictureImaging.GetStat() = GdPictureStatus.OK Then
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.NewPDF() = GdPictureStatus.OK Then
Dim message As String = ""
gdpicturePDF.SetMRCImageBackgroundResolution(100)
gdpicturePDF.SetMRCPreserveSmoothing(False)
For i As Integer = 1 To count
message = message + "The image nr." + i.ToString()
If (gdpictureImaging.SelectPage(imageID, i) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.AddImageFromGdPictureImage(imageID, PdfAdvancedImageCompression.PdfAdvancedImageCompressionMRC) = GdPictureStatus.OK) Then
message = message + " has been successfully drawn." + vbCrLf
Else
message = message + " has not been drawn - the last status is " + gdpicturePDF.GetStat().ToString() + "." + vbCrLf
End If
Next
If gdpicturePDF.SaveToFile("test_AddImageFromGdPictureImage.pdf", True) = GdPictureStatus.OK Then
message = message + "The file has been saved successfully."
Else
message = message + "The file can't be saved. Status: " + gdpicturePDF.GetStat().ToString()
End If
MessageBox.Show(message, caption)
Else
MessageBox.Show("The NewPDF() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
gdpicturePDF.Dispose()
Else
MessageBox.Show("The GetPageCount() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption)
End If
gdpictureImaging.ReleaseGdPictureImage(imageID)
gdpictureImaging.Dispose()
string caption = "Example: AddImageFromGdPictureImage";
GdPictureImaging gdpictureImaging = new GdPictureImaging();
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("multi_image.tif");
if (gdpictureImaging.GetStat() == GdPictureStatus.OK)
{
int count = gdpictureImaging.GetPageCount(imageID);
if (gdpictureImaging.GetStat() == GdPictureStatus.OK)
{
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.NewPDF() == GdPictureStatus.OK)
{
string message = "";
gdpicturePDF.SetMRCImageBackgroundResolution(100);
gdpicturePDF.SetMRCPreserveSmoothing(false);
for (int i = 1; i <= count; i++)
{
message = message + "The image nr." + i.ToString();
if ((gdpictureImaging.SelectPage(imageID, i) == GdPictureStatus.OK) &&
(gdpicturePDF.AddImageFromGdPictureImage(imageID, PdfAdvancedImageCompression.PdfAdvancedImageCompressionMRC) == GdPictureStatus.OK))
message = message + " has been successfully drawn.\n";
else
message = message + " has not been drawn - the last status is " + gdpicturePDF.GetStat().ToString() + ".\n";
}
if (gdpicturePDF.SaveToFile("test_AddImageFromGdPictureImage.pdf", true) == GdPictureStatus.OK)
message = message + "The file has been saved successfully.";
else
message = message + "The file can't be saved. Status: " + gdpicturePDF.GetStat().ToString();
MessageBox.Show(message, caption);
}
else
MessageBox.Show("The NewPDF() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
gdpicturePDF.Dispose();
}
else
MessageBox.Show("The GetPageCount() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption);
}
else
MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption);
gdpictureImaging.ReleaseGdPictureImage(imageID);
gdpictureImaging.Dispose();