String path="Your PDF Path"; // ----------> like C:\Books\Hello.pdf
String BookTitle = " ";
String Author = " ";
String Description = " ";
String Publisher = " ";
int TotalPage=0;
PdfReader reader=null;
reader = new PdfReader( path);
HashMap map = null;
map = new HashMap();
map = reader.getInfo();
int nums = reader.getNumberOfPages();
if (map.containsKey("Title")) {
BookTitle = map.get("Title").toString().trim();
}
if (map.containsKey("Author")) {
Author = map.get("Author");
}
if (map.containsKey("Subject")) {
Description = map.get("Subject");
}
TotalPage = nums;
if (map.containsKey("Producer")) {
Publisher = map.get("Producer");
}
No comments:
Post a Comment