I want to erase all pdf files that do not contain text. I tried to use a PdfBox.
Method pdftoText
converts pdf to String.
public static void main(String[] args) throws FileNotFoundException, InterruptedException {
String pdfText = PDFTextParser.pdftoText("xxx.pdf"); //files[i]);
if (pdfText == "") {
File toBeDeletedFile = new File(location+"xxx.pdf");
if (toBeDeletedFile.delete()) {
System.out.println("success");
}
else {
System.out.println("still there");
}
}
}
}
This did not bring any results