Friday, December 31, 2021

Read the content of a PDF file using Java API

import org.apache.pdfbox.text.PDFTextStripper;
import org.apache.pdfbox.pdmodel.PDDocument; 
PDdocument pdDocument = PDdocument.load(new File("your filepath) )); 
PDFTextStripper stripper = new PDFTextStripper () ; 
String fileContent = stripper.getText(pdDocument) ; 
System.out.println(text) ;

No comments:

Post a Comment