| |
29. 32. 4. 获取元数据格式文件 |
|
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()));
}
}
}
|
|
|