Every PDF document has some Meta Information like Title, Author Name, Creation Date etc. Aspose.Pdf.Kit (Java Version ) allows developers to control this meta information.
To show meta information of the PDF documents, we use PdfFileInfo (Java Version ) class by calling its constructor that takes the input PDF file name as string argument. Then developers can display the meta information through properties ( Title (Java Version ) Author (Java Version ) CreationDate (Java Version ) Creator (Java Version ) Keywords (Java Version ) ModDate (Java Version ) Producer (Java Version ) Header (Java Version ) NumberOfPages (Java Version ) and Subject (Java Version ) of PdfFileInfo (Java Version ) class.
Code Snippet
[C#]
//Variable to hold input PDF file name and path
string inFile = ".\\example.pdf";
//Instantiating PdfFileInfo object and passing input PDF file to its constructor
PdfFileInfo fileInfo = new PdfFileInfo(inFile);
//Displaying Title of the input PDF file
System.Console.WriteLine("TITLE: " + fileInfo.Title);
//Displaying Author of the input PDF file
System.Console.WriteLine("AUTHOR:" + fileInfo.Author);
//Displaying Creation Date of the input PDF file
System.Console.WriteLine("CREATIONDATE:"+ fileInfo.CreationDate);
//Displaying Creator of the input PDF file
System.Console.WriteLine("CREATOR:"+fileInfo.Creator);
//Displaying Keywords of the input PDF file
System.Console.WriteLine("KeyWORDS:"+fileInfo.Keywords);
//Displaying Last Modification Date of the input PDF file
System.Console.WriteLine("MODDATE:"+fileInfo.ModDate);
[VB.NET]
'Variable to hold input PDF file name and path
Dim inFile As String = ".\\example.pdf"
'Instantiating PdfFileInfo object and passing input PDF file to its constructor
Dim fileInfo As PdfFileInfo = New PdfFileInfo(inFile)
'Displaying Title of the input PDF file
System.Console.WriteLine("TITLE: " + fileInfo.Title)
'Displaying Author of the input PDF file
System.Console.WriteLine("AUTHOR:" + fileInfo.Author)
'Displaying Creation Date of the input PDF file
System.Console.WriteLine("CREATIONDATE:"+ fileInfo.CreationDate)
'Displaying Creator of the input PDF file
System.Console.WriteLine("CREATOR:"+fileInfo.Creator)
'Displaying Keywords of the input PDF file
System.Console.WriteLine("KeyWORDS:"+fileInfo.Keywords)
'Displaying Last Modification Date of the input PDF file
System.Console.WriteLine("MODDATE:"+fileInfo.ModDate)
[Java]
PdfFileInfo fileInfo = new PdfFileInfo(inFile);
System.out.println("TITLE: " + fileInfo.getTitle());
System.out.println("AUTHOR:" + fileInfo.getAuthor());
System.out.println("CREATIONDATE:" + fileInfo.getCreationDate());
System.out.println("CREATOR:" + fileInfo.getCreator());
System.out.println("KeyWORDS:" + fileInfo.getKeywords());
System.out.println("MODDATE:" + fileInfo.getModDate());
HashMap header = fileInfo.getHeader();
Object[] headerKeys = header.keySet().toArray();
for (int hIndex = 0; hIndex < headerKeys.length; hIndex++) {
System.out.println(headerKeys[hIndex].toString() + ":" + header.get(headerKeys[hIndex].toString()));
}