Tuesday, November 14, 2017

How to read PDF using JAVA

import java.io.File; 
import java.io.IOException; 
import org.apache.pdfbox.pdmodel.PDDocument; 
import org.apache.pdfbox.text.PDFTextStripper; 
import org.apache.pdfbox.text.PDFTextStripperByArea;


class mytext
{
 public static void main(String[] args)
 {
 
 
 try {
    PDDocument document = null;
    document = PDDocument.load(new File("H:\\test.pdf"));
    document.getClass();
    if (!document.isEncrypted()) {
        PDFTextStripperByArea stripper = new PDFTextStripperByArea();
        stripper.setSortByPosition(true);
        PDFTextStripper Tstripper = new PDFTextStripper();
        String st = Tstripper.getText(document);
        System.out.println("Text:" + st);
    }
} catch (Exception e) {
    e.printStackTrace();
}



 }
}


PDF Box API can be downloaded from :

https://pdfbox.apache.org/index.html
its an open source.

Also available in my google drive version 2.0.8 - https://drive.google.com/open?id=1S_7Jq-D2FG1ebe04pOywdYy7YxxbTUFr


6 comments:

  1. To read the PDF using the Java file is not an easy thing. You can make your file more strong from this article. You can also download the API from this section. The medical fellowship personal statement can give you the better source for your work.

    ReplyDelete
  2. As I read about your Topic, it’s really good which I get some useful information and I must participate in it. Thank you for share. Also I got another one from Google it also really good. Check this out it you like useful site

    ReplyDelete
  3. When i various ones own Area, it’s ideal that we buy some invaluable tips and even I've got to perform the application http://www.insidetheapp.com/runtastic-review/. Thanks for your time designed for have. Moreover I received someone else as a result of Google and yahoo moreover it ideal.

    ReplyDelete