Forum Discussion

sameerjade's avatar
sameerjade
Frequent Contributor
8 years ago

JScript runtime error. Type mismatch Error with JavaClasses method

Hello,

 

I am getting an error:

JScript runtime error. Type mismatch Error

 

Here is my code. The error happens with the red highlighted line. 

 

function getAllText(_filePath)
{
var textStripperObj, text;
var docObj = loadDocument(_filePath);

// Create an instance of the PDFStripper object
textStripperObj = JavaClasses.org_apache_pdfbox_util.PDFTextStripper.newInstance();
textStripperObj.setSortByPosition(true);
// Obtain the text of the document
text = textStripperObj.getText_2(docObj);
Log.Message(text);


return text;
}

 

If I replace the red line with the following line, then I don't get any errors. I got this line from some old code.

textStripperObj = dotNET["org_apache_pdfbox_util"]["PDFTextStripper"]["zctor_2"]();

 

Any suggestions, what might be the issue? Thank you!

 

-Sameer

3 Replies