Question
Bits in Glass
IN
Last activity: 28 May 2021 6:31 EDT
*The constructor PDFParser(PRInputStream) is undefined* error thrown in pega 8.3
I am trying to read pdf file using PDFBox. I got the code which was used in 7.3, I am using that in 8.3. I modified the code and almost was able to clear all the errors except one(PDFParser constructor is throwing error). I have attached the screenshot of the error. Please advice me on the same.
Code:-
org.apache.pdfbox.text.PDFTextStripper pdfStripper = null;
org.apache.pdfbox.pdmodel.PDDocument pdDoc=null;
org.apache.pdfbox.cos.COSDocument cosDoc = null;
ParameterPage pp = tools.getParameterPage();
try{
String filePath = pp.getString("FullFilePathName"); //java.io.File file = new java.io.File(filePath);
PRFile prfCheck = new PRFile(filePath); // java.io.FileInputStream fis=null;
PRInputStream fis = null;
org.apache.pdfbox.pdfparser.PDFParser parser = new org.apache.pdfbox.pdfparser.PDFParser(new PRInputStream(prfCheck));
parser.parse(); cosDoc = parser.getDocument();
pdfStripper = new org.apache.pdfbox.text.PDFTextStripper();
pdDoc = new org.apache.pdfbox.pdmodel.PDDocument(cosDoc);
String parsedText = pdfStripper.getText(pdDoc);
tools.putParamValue("ContentSourceAuthored",parsedText); }catch(Exception e) { throw new PRRuntimeException("Unable to read file '"+e); }