GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / PdfGetSubject Method
Example





PdfGetSubject Method (GdViewer)
Returns the subject 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 PdfGetSubject() As String
 

Return Value

The value of the document's Subject property as a string. The GdViewer.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 GdViewer.GetStat method to identify the specific reason for the method's failure, if any.
Example
How to get the subject 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 + "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.PdfGetSubject")
Else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PdfGetSubject")
End If
See Also