GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / GetAuthor Method
Example





In This Topic
GetAuthor Method (GdPicturePDF)
In This Topic
Returns the author of the currently loaded PDF document, if any is set in the document information dictionary.
Syntax
'Declaration
 
Public Function GetAuthor() As String
public string GetAuthor()
public function GetAuthor(): String; 
public function GetAuthor() : String;
public: string* GetAuthor(); 
public:
String^ GetAuthor(); 

Return Value

The value of the document's Author property as a string. The 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 GetStat method to identify the specific reason for the method's failure, if any.

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