Example





In This Topic

GetKeywords Method (GdPicturePDF)

In This Topic
Returns the keywords associated with the currently loaded PDF document, if any are set in the document information dictionary.
Syntax
'Declaration
 
Public Function GetKeywords() As String
public string GetKeywords()
public function GetKeywords(): String; 
public function GetKeywords() : String;
public: string* GetKeywords(); 
public:
String^ GetKeywords(); 

Return Value

The value of the document's Keywords property 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 keywords associated with the PDF document.
Using gdpicturePDF As New GdPicturePDF()
    If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
        Dim keywords As String = gdpicturePDF.GetKeywords()
        Dim status As GdPictureStatus = gdpicturePDF.GetStat()
        If status = GdPictureStatus.OK Then
            MessageBox.Show("The associated keywords are: " + keywords, "Example: GetKeywords")
        Else
            MessageBox.Show("The GetKeywords() method has failed with the status: " + status.ToString(), "Example: GetKeywords")
        End If
    Else
        MessageBox.Show("The file can't be loaded.", "Example: GetKeywords")
    End If
End Using
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
    if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
    {
        string keywords = gdpicturePDF.GetKeywords();
        GdPictureStatus status = gdpicturePDF.GetStat();
        if (status == GdPictureStatus.OK)
        {
            MessageBox.Show("The associated keywords are: " + keywords, "Example: GetKeywords");
        }
        else
        {
            MessageBox.Show("The GetKeywords() method has failed with the status: " + status.ToString(), "Example: GetKeywords");
        }
    }
    else
    {
        MessageBox.Show("The file can't be loaded.", "Example: GetKeywords");
    }
}
See Also