1

I am trying to read pdf file which is containing table data and insert those data's into database using java.i don't know how to do this can any one help me to do this.

for example:

I am having pdf file with 3 rows ans 3 columns table with data's. I need to insert those column data's to table column's.

KVK
  • 1,257
  • 2
  • 17
  • 48
  • [PDF to Java](http://stackoverflow.com/questions/4784825/how-to-read-pdf-files-using-java) – Bill F May 15 '17 at 06:28
  • Possible duplicate: http://stackoverflow.com/questions/4784825/how-to-read-pdf-files-using-java – mkilmanas May 15 '17 at 07:08
  • 1
    Possible duplicate of [How to read PDF files using Java?](http://stackoverflow.com/questions/4784825/how-to-read-pdf-files-using-java) – mkilmanas May 15 '17 at 07:08

2 Answers2

1

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();
        }

    }

}
gati sahu
  • 2,576
  • 2
  • 10
  • 16
0
  1. PDFBox The Apache PDFBox® library is an open source Java tool for working with PDF documents.
  2. iText

You can use these library to accomplish your task.

Mehraj Malik
  • 14,872
  • 15
  • 58
  • 85