using iTextSharp.text; using iTextSharp.text.pdf; // Creating a new PDF document Document document = new Document(); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream("example.pdf", FileMode.Create)); // Adding creation date to the document document.AddCreationDate(); // Closing the document document.Close();
using iTextSharp.text; using iTextSharp.text.pdf; using System; // Opening an existing PDF document PdfReader reader = new PdfReader("example.pdf"); // Getting the document creation date DateTime creationDate = reader.Info.CreationDate; // Closing the reader reader.Close();This example uses the iTextSharp.text library to open an existing PDF document named "example.pdf" and retrieve its creation date using the PdfReader class. The creation date is then stored in a DateTime variable named "creationDate".