Question

66
Views
AnoopK12 Member since 2017 2 posts
Hexaware Technologies
Posted: 4 months ago
Last activity: 4 months 1 week ago

*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); }

Pega Customer Service 8.3
Share this page LinkedIn