Example





In This Topic

GetLastPath Method (GdPictureImaging)

In This Topic
Returns the file path of the latest loaded or saved file using this GdPictureImaging object.
Syntax
'Declaration
 
Public Function GetLastPath() As String
public string GetLastPath()
public function GetLastPath(): String; 
public function GetLastPath() : String;
public: string* GetLastPath(); 
public:
String^ GetLastPath(); 

Return Value

The file path of the latest loaded or saved file, otherwise an empty string.
Remarks
Be aware, that the stored value is never erased, for example, when releasing the image. It is only overwritten with each new file loading or saving operation.
Example
Saving the image as a PDF document specifying document properties and retrieving the file name of the created image for further use.
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);
}
See Also