solved errors. in Filechooser and PDFTextstripper
parent
b4abbf8282
commit
21546dd91d
|
|
@ -18,12 +18,15 @@ public class FileManager {
|
||||||
if (result == JFileChooser.APPROVE_OPTION) {
|
if (result == JFileChooser.APPROVE_OPTION) {
|
||||||
File selectedFile = fileChooser.getSelectedFile();
|
File selectedFile = fileChooser.getSelectedFile();
|
||||||
System.out.println("Ausgewählte Datei: " + selectedFile.getAbsolutePath());
|
System.out.println("Ausgewählte Datei: " + selectedFile.getAbsolutePath());
|
||||||
// Hier kannst du die Datei weiterverarbeiten
|
|
||||||
|
|
||||||
try (PDDocument document = PDDocument.load(selectedFile)) {
|
try (PDDocument document = PDDocument.load(selectedFile)) {
|
||||||
PDFTextStripper pdfStripper = new PDFTextStripper();
|
PDFTextStripper pdfStripper = new PDFTextStripper();
|
||||||
String text = pdfStripper.getText(document);
|
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 {
|
else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue