You can use iText PDF library for reading and writing.If you are using Maven project please add
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.10</version>
</dependency>
PDF Reader will read from pdf file and pass to writer which will write to DB.
pdf reader sample example
public class PdfReadExample {
private static final String FILE_NAME = "/tmp/myexample.pdf";
public static void main(String[] args) {
PdfReader reader;
try {
reader = new PdfReader("f:/myexample.pdf");
// pageNumber = 1
String textFromPage = PdfTextExtractor.getTextFromPage(reader, 1);
System.out.println(textFromPage);
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}