use of org.pdfparse.model.PDFDocument in project FBReaderJ by geometer.
the class PDFPlugin method readMetainfo.
@Override
public void readMetainfo(AbstractBook book) {
final ZLFile file = BookUtil.fileByBook(book);
if (file != file.getPhysicalFile()) {
// TODO: throw BookReadingException
System.err.println("Only physical PDF files are supported");
return;
}
try {
final PDFDocument doc = new PDFDocument(book.getPath());
// TODO: solution for rc4 encryption
if (!doc.isEncrypted()) {
final PDFDocInfo info = doc.getDocumentInfo();
book.setTitle(info.getTitle());
book.addAuthor(info.getAuthor());
}
} catch (Throwable e) {
e.printStackTrace();
}
}
Aggregations