GetStat Method (GdPictureImaging)
In This Topic
Returns the status of the last executed operation with the current GdPictureImaging object.
Syntax
Return Value
A member of the GdPictureStatus enumeration. If the last executed GdPictureImaging method has been successfully followed, then the return value is GdPictureStatus.OK.
We strongly recommend always checking this status first.
Example
Retrieving the status of the last executed operation.
Saving the image as a PDF document after the image has been successfully created.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("");
if (gdpictureImaging.GetStat() == GdPictureStatus.OK)
{
// Get the file path of the loaded image file.
string filePath = gdpictureImaging.GetLastPath();
string pdfPath = System.IO.Path.ChangeExtension(filePath, ".pdf");
// Get the current version of the GdPicture.NET toolkit.
string version = (gdpictureImaging.GetVersion()).ToString();
version = version.Insert(version.IndexOf('.') + 2, ".");
// Define the document properties when saving, for example, the current version of the GdPicture.NET toolkit.
gdpictureImaging.SaveAsPDF(imageID, pdfPath, false, "Saving image as PDF", "GdPicture ver." + version.ToString(), "For test", "image, pdf", "Orpalis");
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
else
MessageBox.Show("An image can't be created.\nError: " + gdpictureImaging.GetStat().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Uploading an image to a file located on a distant server using FTP transfer.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// Set the transferring options.
gdpictureImaging.SetFtpPassiveMode(true);
gdpictureImaging.SetHttpTransferBufferSize(2048);
if (gdpictureImaging.UploadFileToFTP(@"D:\images\image.jpg", "ftp.com", "/demo/image.jpg", "user", "password", 21) != GdPictureStatus.OK)
{
MessageBox.Show("Uploading failed. Status: " + gdpictureImaging.GetStat() + "\nError: " + gdpictureImaging.GetLastTransferError(),
"Uploading using FTP", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
Example
Retrieving the status of the last executed operation.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("");
if (gdpictureImaging.GetStat() == GdPictureStatus.OK)
{
// Get the file path of the loaded image file.
string filePath = gdpictureImaging.GetLastPath();
string pdfPath = System.IO.Path.ChangeExtension(filePath, ".pdf");
// Get the current version of the GdPicture.NET toolkit.
string version = (gdpictureImaging.GetVersion()).ToString();
version = version.Insert(version.IndexOf('.') + 2, ".");
// Define the document properties when saving, for example, the current version of the GdPicture.NET toolkit.
gdpictureImaging.SaveAsPDF(imageID, pdfPath, false, "Saving image as PDF", "GdPicture ver." + version.ToString(), "For test", "image, pdf", "Orpalis");
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
else
MessageBox.Show("An image can't be created.\nError: " + gdpictureImaging.GetStat().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// Set the transferring options.
gdpictureImaging.SetFtpPassiveMode(true);
gdpictureImaging.SetHttpTransferBufferSize(2048);
if (gdpictureImaging.UploadFileToFTP(@"D:\images\image.jpg", "ftp.com", "/demo/image.jpg", "user", "password", 21) != GdPictureStatus.OK)
{
MessageBox.Show("Uploading failed. Status: " + gdpictureImaging.GetStat() + "\nError: " + gdpictureImaging.GetLastTransferError(),
"Uploading using FTP", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
See Also