RED-4875 - add possibility to call if with pdfdoc-object
This commit is contained in:
parent
8a35a1bd90
commit
e8b89f66c6
@ -14,9 +14,7 @@ import com.pdftron.pdf.TextExtractor;
|
|||||||
|
|
||||||
public class PdfTextExtraction {
|
public class PdfTextExtraction {
|
||||||
|
|
||||||
public static String extractAllTextFromDocument(InputStream fileStream) throws IOException, PDFNetException {
|
private static String execute(PDFDoc pdfDoc) throws IOException, PDFNetException{
|
||||||
|
|
||||||
PDFDoc pdfDoc = new PDFDoc(fileStream);
|
|
||||||
TextExtractor extractor = new TextExtractor();
|
TextExtractor extractor = new TextExtractor();
|
||||||
List<String> texts = new ArrayList<>();
|
List<String> texts = new ArrayList<>();
|
||||||
|
|
||||||
@ -32,4 +30,13 @@ public class PdfTextExtraction {
|
|||||||
return String.join("\n", texts);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user