Good afternoon.
I wonder if anyone can help me. I need to extract data from a PDF file, however I need to read page by page of the file, if anyone can help me thank you.
public static void main(String args[]) {
PDFTextStripper pdfStripper = null;
PDDocument pdDoc = null;
COSDocument cosDoc = null;
File file = new File("C\testes\teste.pdf");
try {
PDFParser parser = new PDFParser(new FileInputStream(file)); //Aqui o FileInputStream está acusando erro;
parser.parse();
cosDoc = parser.getDocument();
pdfStripper = new PDFTextStripper();
pdDoc = new PDDocument(cosDoc);
pdfStripper.setStartPage(1);
pdfStripper.setEndPage(5);
String parsedText = pdfStripper.getText(pdDoc);
System.out.println(parsedText);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}