Set PDF Metadata
Contents
[
Hide
]
Set PDF metadata
Use this workflow when you need to normalize or enrich document information before saving the PDF.
Steps
- Create a
PdfFileInfoobject for the source PDF. - Set the standard metadata fields you want to update.
- Add any custom metadata with
setMetaInfo. - Save the updated document with
save(). - Close the
PdfFileInfoinstance.
Java example
public static void setPdfMetadata(Path inputFile, Path outputFile) {
PdfFileInfo pdfInfo = new PdfFileInfo(inputFile.toString());
pdfInfo.setSubject("Aspose PDF for Java");
pdfInfo.setTitle("Aspose PDF for Java");
pdfInfo.setKeywords("Aspose, PDF, Java");
pdfInfo.setCreator("Aspose Team");
pdfInfo.setMetaInfo("CustomKey", "CustomValue");
pdfInfo.save(outputFile.toString());
pdfInfo.close();
}