Add XMP metadata automatically, based on the PDF metadata : Metadata « PDF « Java Tutorial






import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

public class MainClass {

  public static void main(String[] args) throws Exception {

    Document document = new Document();
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.addTitle("title");
    document.addSubject("subject");
    document.addKeywords("keywords");
    document.addCreator("creator");
    document.addAuthor("author");
    writer.createXmpMetadata();
    document.open();
    document.add(new Paragraph("Hello World"));
    document.close();
  }
}








29.32.Metadata
29.32.1.Read PDF to add some metadata
29.32.2.Get Pdf metadata
29.32.3.Add XMP metadata automatically, based on the PDF metadata
29.32.4.Get meta data from pdf document
29.32.5.Set meta data to pdf document
29.32.6.use PdfSchema to update Meta data