RED-4875 - add possibility to call if with pdfdoc-object

This commit is contained in:
Thomas Beyer 2023-03-20 08:56:23 +01:00
parent 8a35a1bd90
commit e8b89f66c6

View File

@ -14,9 +14,7 @@ import com.pdftron.pdf.TextExtractor;
public class PdfTextExtraction {
public static String extractAllTextFromDocument(InputStream fileStream) throws IOException, PDFNetException {
PDFDoc pdfDoc = new PDFDoc(fileStream);
private static String execute(PDFDoc pdfDoc) throws IOException, PDFNetException{
TextExtractor extractor = new TextExtractor();
List<String> texts = new ArrayList<>();
@ -32,4 +30,13 @@ public class PdfTextExtraction {
return String.join("\n", texts);
}
public static String extractAllTextFromDocument(InputStream fileStream) throws IOException, PDFNetException {
PDFDoc pdfDoc = new PDFDoc(fileStream);
return execute(pdfDoc);
}
public static String extractAllTextFromDocument(PDFDoc pdfDoc) throws IOException, PDFNetException {
return execute(pdfDoc);
}
}