Save Metadata with XMP

Save metadata with XMP

Use this workflow when you need the updated document information to be stored in XMP format.

Steps

  1. Create a PdfFileInfo object for the source PDF.
  2. Set the metadata fields you want to update, such as subject, title, keywords, and creator.
  3. Call saveNewInfoWithXmp() with the output file path.
  4. Close the PdfFileInfo instance.

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();
}