Read the document info from a PDF

Manipulate PDF
11/2/2011

Read document info such as Author, Title and Subject from a PDF document.

C# Code sample

1 using (FileStream file = new FileStream(@"..\..\..\inputDocuments\SellingYourHome.pdf", FileMode.Open, FileAccess.Read)) 2 { 3 Document document = new Document(file); 4 5 Console.WriteLine("Author: "+ document.DocumentInfo.Author); 6 Console.WriteLine("Creation date: " + document.DocumentInfo.CreationDate); 7 Console.WriteLine("Creator: " + document.DocumentInfo.Creator); 8 Console.WriteLine("Keywords: " + document.DocumentInfo.Keywords); 9 Console.WriteLine("Last modified on: " + document.DocumentInfo.LastModifiedDate); 10 Console.WriteLine("Producer: " + document.DocumentInfo.Producer); 11 Console.WriteLine("Subject: "+ document.DocumentInfo.Subject); 12 Console.WriteLine("Title: "+ document.DocumentInfo.Title); 13 }

VB.NET code sample

1 Using file As New FileStream("..\..\..\inputDocuments\SellingYourHome.pdf", FileMode.Open, FileAccess.Read) 2 Dim document As New Document(file) 3 4 Console.WriteLine("Author: " + document.DocumentInfo.Author) 5 Console.WriteLine("Creation date: " + document.DocumentInfo.CreationDate) 6 Console.WriteLine("Creator: " + document.DocumentInfo.Creator) 7 Console.WriteLine("Keywords: " + document.DocumentInfo.Keywords) 8 Console.WriteLine("Last modified on: " + document.DocumentInfo.LastModifiedDate) 9 Console.WriteLine("Producer: " + document.DocumentInfo.Producer) 10 Console.WriteLine("Subject: " + document.DocumentInfo.Subject) 11 Console.WriteLine("Title: " + document.DocumentInfo.Title) 12 End Using