PdfGetAuthor Method (GdViewer)
In This Topic
Returns the author 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 PdfGetAuthor() As String
public string PdfGetAuthor()
public function PdfGetAuthor(): String;
public function PdfGetAuthor() : String;
public: string* PdfGetAuthor();
public:
String^ PdfGetAuthor();
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.
Example
How to get the author of the displayed PDF document.
'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 + "Creator: " + GdViewer1.PdfGetCreator() +
vbCrLf + "Producer: " + GdViewer1.PdfGetProducer()
Else
message += vbCrLf + "This file is not a PDF document, its format is: " + GdViewer1.GetDocumentType().ToString()
End If
MessageBox.Show(message, "GdViewer.PdfGetAuthor")
Else
MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PdfGetAuthor")
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() +
"\nCreator: " + GdViewer1.PdfGetCreator() +
"\nProducer: " + GdViewer1.PdfGetProducer();
}
else
{
message += "\nThis file is not a PDF document, its format is: " + GdViewer1.GetDocumentType().ToString();
}
MessageBox.Show(message, "GdViewer.PdfGetAuthor");
}
else
MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PdfGetAuthor");
Example
How to get the author of the displayed PDF document.
'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 + "Creator: " + GdViewer1.PdfGetCreator() +
vbCrLf + "Producer: " + GdViewer1.PdfGetProducer()
Else
message += vbCrLf + "This file is not a PDF document, its format is: " + GdViewer1.GetDocumentType().ToString()
End If
MessageBox.Show(message, "GdViewer.PdfGetAuthor")
Else
MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PdfGetAuthor")
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() +
"\nCreator: " + GdViewer1.PdfGetCreator() +
"\nProducer: " + GdViewer1.PdfGetProducer();
}
else
{
message += "\nThis file is not a PDF document, its format is: " + GdViewer1.GetDocumentType().ToString();
}
MessageBox.Show(message, "GdViewer.PdfGetAuthor");
}
else
MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PdfGetAuthor");
See Also