GdPicture.NET Reference Guide
PdfGetKeywords Method (GdViewer)
Example 





GdPicture14.WPF Namespace > GdViewer Class : PdfGetKeywords Method
Returns the keywords of the currently displayed PDF document, if any is set in the document information dictionary. If the document currently displayed in the GdViewer control is not the PDF file, the method will fail.
Syntax
'Declaration
 
Public Function PdfGetKeywords() As String
public string PdfGetKeywords()
public function PdfGetKeywords(): String; 
public function PdfGetKeywords() : String;
public: string* PdfGetKeywords(); 
public:
String^ PdfGetKeywords(); 

Return Value

The value of the document's Keywords property as a string. Please always use the GetStat method to determine if this method has been successful.
Remarks
Please note that this method is only meaningful for PDF documents, otherwise it returns an empty string. We strongly recommend using the GetStat method to identify the specific reason for the method's failure.
Example
How to find out the keywords associated with the loaded PDF document.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
    Dim filename As String = GdViewer1.GetLastPath()
    Dim message As String = "The current file is: " + filename
    If GdViewer1.GetDocumentType() = DocumentType.DocumentTypePDF Then
        message += vbCrLf + "PDF Version: " + GdViewer1.PdfGetVersion() +
                   vbCrLf + "Keywords: " + GdViewer1.PdfGetKeywords()
        'Retrieving the PDF metadata.
        Dim metadata As String = GdViewer1.PdfGetMetadata()
        If GdViewer1.GetStat() = GdPictureStatus.OK Then
            Dim metadataFile As String = filename.Replace(".pdf", "_metadata.xmp")
            System.IO.File.WriteAllText(metadataFile, metadata)
            message += vbCrLf + "Metadata has been successfully saved. File: " + metadataFile
        Else
            message += vbCrLf + "Metadata has not been retrieved. Status: " + GdViewer1.GetStat().ToString()
        End If
    Else
        message += vbCrLf + "This file is not a PDF document, its format is: " + GdViewer1.GetDocumentType().ToString()
    End If
            
    MessageBox.Show(message, "GdViewer.PdfGetKeywords")
Else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PdfGetKeywords")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
    string filename = GdViewer1.GetLastPath();
    string message = "The current file is: " + filename;
    if (GdViewer1.GetDocumentType() == DocumentType.DocumentTypePDF)
    {
        message += "\nPDF Version: " + GdViewer1.PdfGetVersion() +
                   "\nKeywords: " + GdViewer1.PdfGetKeywords();
        //Retrieving the PDF metadata.
        string metadata = GdViewer1.PdfGetMetadata();
        if (GdViewer1.GetStat() == GdPictureStatus.OK)
        {
            string metadataFile = filename.Replace(".pdf", "_metadata.xmp");
            System.IO.File.WriteAllText(metadataFile, metadata);
            message += "\nMetadata has been successfully saved. File: " + metadataFile;
        }
        else
            message += "\nMetadata has not been retrieved. Status: " + GdViewer1.GetStat().ToString();
    }
    else
    {
        message += "\nThis file is not a PDF document, its format is: " + GdViewer1.GetDocumentType().ToString();
    }
    MessageBox.Show(message, "GdViewer.PdfGetKeywords");
}
else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PdfGetKeywords");
See Also

Reference

GdViewer Class
GdViewer Members
GetLastPath Method
GetDocumentType Method
PdfGetMetadata Method
PdfGetEncryptionScheme Method