GdPicture.NET.14
GdPicture14.WPF Namespace / GdViewer Class / PdfGetVersion Method
Example





In This Topic
PdfGetVersion Method (GdViewer)
In This Topic
Returns the version of the PDF specification to which the currently displayed PDF document conforms. If the document currently displayed in the GdViewer control is not the PDF file, the method will fail.
Syntax
'Declaration
 
Public Function PdfGetVersion() As String
public string PdfGetVersion()
public function PdfGetVersion(): String; 
public function PdfGetVersion() : String;
public: string* PdfGetVersion(); 
public:
String^ PdfGetVersion(); 

Return Value

The value of the PDF version conformity as a string. The GetStat method can be subsequently used to determine if this method has been successful.
Remarks
This method is only meaningful for PDF documents, otherwise it returns an empty string. It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.
Example
How to get the current version of the PDF specification to which the displayed PDF document conforms.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
    Dim message As String = "The current file is: " + GdViewer1.GetLastPath()
    If GdViewer1.GetDocumentType() = DocumentType.DocumentTypePDF Then
        message += vbCrLf + "Author: " + GdViewer1.PdfGetAuthor() +
                   vbCrLf + "Title: " + GdViewer1.PdfGetTitle() +
                   vbCrLf + "Subject: " + GdViewer1.PdfGetSubject() +
                   vbCrLf + "PDF Version: " + GdViewer1.PdfGetVersion()
    Else
        message += vbCrLf + "This file is not a PDF document, its format is: " + GdViewer1.GetDocumentType().ToString()
    End If
    MessageBox.Show(message, "GdViewer.PdfGetVersion")
Else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PdfGetVersion")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
    string message = "The current file is: " + GdViewer1.GetLastPath();
    if (GdViewer1.GetDocumentType() == DocumentType.DocumentTypePDF)
    {
        message += "\nAuthor: " + GdViewer1.PdfGetAuthor() +
                   "\nTitle: " + GdViewer1.PdfGetTitle() +
                   "\nSubject: " + GdViewer1.PdfGetSubject() +
                   "\nPDF Version: " + GdViewer1.PdfGetVersion();
    }
    else
    {
        message += "\nThis file is not a PDF document, its format is: " + GdViewer1.GetDocumentType().ToString();
    }
    MessageBox.Show(message, "GdViewer.PdfGetVersion");
}
else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PdfGetVersion");
See Also