Change PDF Information

Skip to end of metadata
Go to start of metadata
Change PDF Information

Every PDF document has some Meta Information like Title, Author Name, Creation Date etc. Aspose.Pdf.Kit allows developers to control this meta information.
To change meta information of the PDF documents, we use PdfFileInfo class by calling its constructor that takes the input PDF file name as string argument. Then developers can modify the meta information through properties ( Title Author CreationDate Creator Keyword ModDate Producer Header NumberOfPages and Title 0) of Title 1 class.
Once the meta information is modified, don't forget to call saveNewInfo method to save the changes to meta information of PDF document.

[Java]
String path = "./examples/resources/";
String inFile = path + "example1.pdf";
String outFile = path + "PdfInfoOut1.pdf";
HashMap header = new HashMap();

header.put("Zone", "+800");
PdfFileInfo fileInfo = null;

fileInfo = new PdfFileInfo(inFile);

fileInfo.setAuthor("William");
fileInfo.setTitle("Hello");
fileInfo.setSubject("Peace");
fileInfo.setKeywords("A,B");
fileInfo.setHeader(null);
fileInfo.saveNewInfo(outFile);
 
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.