Save Metadata with XMP
Contents
[
Hide
]
Save metadata with XMP
Use this workflow when you need the updated document information to be stored in XMP format.
Steps
- Create a
PdfFileInfoobject for the source PDF. - Set the metadata fields you want to update, such as subject, title, keywords, and creator.
- Call
saveNewInfoWithXmp()with the output file path. - Close the
PdfFileInfoinstance.
Java example
public static void saveInfoWithXmp(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.saveNewInfoWithXmp(outputFile.toString());
pdfInfo.close();
}