Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3358 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi everybody

I have an error using scriptmaster 4.42 release when I try to convert a pdf file into text. I have no problem with 4.201 release.

The function reurns ERROR and SMLastError is set as "java.lang.NoClassDefFoundError: org/bouncycastle/cms/Recipient"

My function is defined as

"import java.io.IOException" & ¶ &
"import com.itextpdf.text.pdf.PdfReader" & ¶ &
"import com.itextpdf.text.pdf.parser.PdfTextExtractor" & ¶ &
¶ &
"if( fm_filePath == null ){ throw new Exception(\"File path required !\")}" & ¶ &
"if (new File( fm_filePath ).exists()){" & ¶ &
"  try{" & ¶ &
"    reader = new PdfReader(fm_filePath)" & ¶ &
"    sb = new StringBuffer()" & ¶ &
"    for (int i = 1; i <= reader.numberOfPages; i++) {" & ¶ &
"      sb.append(PdfTextExtractor.getTextFromPage(reader, i))" & ¶ &
"    }" & ¶ &
"    return sb " & ¶ &
"  } catch (IOException e) {" & ¶ &
"    e.printStackTrace()" & ¶ &
"    return \"IO ERROR.\"" & ¶ &
"  } catch (Exception e) {" & ¶ &
"    e.printStackTrace()" & ¶ &
"    return \"ERROR.\"" & ¶ &
"  }" & ¶ &
"}"

Starting from SMLastError I added bouncycastle jar in my filemaker solution. No change, so I tried to add as well such as import steps :

"import java.io.*" & ¶ &
"import java.util.*" & ¶ &
"import java.security.*" & ¶ &

"import org.bouncycastle.jce.provider.BouncyCastleProvider" & ¶ &

I found these steps on other forums, but without any documentation, it looks like fishing...

One thing changes : when I use "import org.bouncycastle.jce.provider.BouncyCastleProvider" SMLastError becomes

java.lang.NoClassDefFoundError: org/bouncycastle/cms/RecipientId

instead of

java.lang.NoClassDefFoundError: org/bouncycastle/cms/Recipient

Thanks in advance

Olivier

Posted

You don't need to alter the code to explicitly call the bouncy castle jars, it is just that PdfReader uses them to check for user passwords and a couple do father things so they have a dependancy on them being loaded.

As Evan says, previously the build of ScriptMaster included a version of Groovy that already had them in the JVM

be more groovy...  for ( i in 1..reader.numberOfPages )

Posted (edited)

Hi,

It works fin adding both bcprov-jdk15on-152.jar and bcpkix-jdk15on-152.jar

Shall I close the topic ?

Thanks and regards

Olivier

Edited by Olivier Chenot

This topic is 3358 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.