diff --git a/src/main/java/com/iqser/red/pdftronlogic/commons/PdfTextExtraction.java b/src/main/java/com/iqser/red/pdftronlogic/commons/PdfTextExtraction.java index d489edf..06d0ea4 100644 --- a/src/main/java/com/iqser/red/pdftronlogic/commons/PdfTextExtraction.java +++ b/src/main/java/com/iqser/red/pdftronlogic/commons/PdfTextExtraction.java @@ -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 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); + } + }