GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / GetVersion Method
Example





In This Topic
GetVersion Method (GdPicturePDF)
In This Topic
Returns the version of the PDF specification to which the currently loaded PDF document conforms.
Syntax
'Declaration
 
Public Function GetVersion() As String
public string GetVersion()
public function GetVersion(): String; 
public function GetVersion() : String;
public: string* GetVersion(); 
public:
String^ GetVersion(); 

Return Value

The value of the PDF version conformity as a string. The GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.
Remarks
This method is only allowed for use with non-encrypted documents.

It is recommend to use the GdPicturePDF.GetStat method to identify the specific reason for the method's failure, if any.

Example
How to find out the PDF version of the PDF document.
Using gdpicturePDF As New GdPicturePDF()
    If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
        Dim version As String = gdpicturePDF.GetVersion()
        Dim status As GdPictureStatus = gdpicturePDF.GetStat()
        If status = GdPictureStatus.OK Then
            MessageBox.Show("The PDF version of this document is: " + version, "Example: GetVersion")
        Else
            MessageBox.Show("The GetVersion() method has failed with the status: " + status.ToString(), "Example: GetVersion")
        End If
    Else
        MessageBox.Show("The file can't be loaded.", "Example: GetVersion")
    End If
End Using
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
    if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
    {
        string version = gdpicturePDF.GetVersion();
        GdPictureStatus status = gdpicturePDF.GetStat();
        if (status == GdPictureStatus.OK)
        {
            MessageBox.Show("The PDF version of this document is: " + version, "Example: GetVersion");
        }
        else
        {
            MessageBox.Show("The GetVersion() method has failed with the status: " + status.ToString(), "Example: GetVersion");
        }
    }
    else
    {
        MessageBox.Show("The file can't be loaded.", "Example: GetVersion");
    }
}
See Also