How to read the text from Pdf using java
how to create pdf and write data see in following linkhttp://javanotes2all.blogspot.in/2013/01/how-to-create-pdf-file-using-itext-in.html
package com.javanotes2all.java.pdf;
import java.io.IOException;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.parser.PdfTextExtractor;
public class ReadDataFromPdf {
//import itext.jar
public static void main(String[] args) throws IOException
{
PdfReader reader = new PdfReader(filename);
int noPages = reader.getNumberOfPages();
PdfTextExtractor extractor = new PdfTextExtractor(reader);
String content="";
for(int page=1;page<=noPages;page++){
int index = 1;
System.out.println(page);
content = extractor.getTextFromPage(page);
System.out.println(content);
}
}
}
0 comments:
Post a Comment