solved errors. in Filechooser and PDFTextstripper

pull/2/head
Daniel Fromm 2025-04-29 16:11:26 +02:00
parent b4abbf8282
commit 21546dd91d
1 changed files with 5 additions and 2 deletions

View File

@ -18,12 +18,15 @@ public class FileManager {
if (result == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
System.out.println("Ausgewählte Datei: " + selectedFile.getAbsolutePath());
// Hier kannst du die Datei weiterverarbeiten
try (PDDocument document = PDDocument.load(selectedFile)) {
PDFTextStripper pdfStripper = new PDFTextStripper();
String text = pdfStripper.getText(document);
System.out.println(text);
String regex = "[,\\s\\.:/]";
String[] words = text.split(regex);
for(String word : words) {
System.out.println(word);
}
}
}
else {