Get meta data from pdf document : Metadata « PDF « Java Tutorial






import java.util.Iterator;
import java.util.Map;

import com.lowagie.text.pdf.PdfReader;

public class MainClass {
  public static void main(String[] args) throws Exception {
    PdfReader reader = new PdfReader("2.pdf");
    Map info = reader.getInfo();
    for (Iterator i = info.keySet().iterator(); i.hasNext();) {
      String key = (String) i.next();
      String value = (String) info.get(key);
      System.out.println(key + ": " + value);
    }
    if (reader.getMetadata() == null) {
      System.out.println("No XML Metadata.");
    } else {
      System.out.println("XML Metadata: " + new String(reader.getMetadata()));
    }
  }

}








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