Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

  • Newbies

Hi, I am very new to using ScriptMaster and have run into some problems when trying to run a few test lines of java. I am trying to create a module that will modify AcroFields on a PDF document, and am therefore going to be using the iText library. I have added this in the Jar Libraries section. Here is the script I am trying to run:

 

import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.kernel.pdf.PdfReader;
import com.itextpdf.forms.PdfAcroForm;

//Initialize PDF document
PdfDocument pdf = new PdfDocument(new PdfReader("C:/Users/Andy/Desktop/VA_Form.pdf"), new PdfWriter("C:/Users/Andy/Desktop/New_VA_Form.pdf"));
PdfAcroForm form = PdfAcroForm.getAcroForm(pdf, true);

and I am getting this error when attempting to run the script:

java.lang.NoClassDefFoundError: com/itextpdf/layout/element/BlockElement

Parameters:
{data="my custom data"}

---Script---
Script:
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.kernel.pdf.PdfReader;
import com.itextpdf.forms.PdfAcroForm;

//Initialize PDF document
PdfDocument pdf = new PdfDocument(new PdfReader("C:/Users/Andy/Desktop/VA_Form.pdf"), new PdfWriter("C:/Users/Andy/Desktop/New_VA_Form.pdf"));
PdfAcroForm form = PdfAcroForm.getAcroForm(pdf, true);
return "true!";

I am not sure how the classpath works in ScriptMaster, but assumed it was to do with this? I have four additional libraries (Itext7-Forms-7.0.0.JarItext7-Io-7.0.0.Jar, Itext7-Kernel-7.0.0.JarItext7-Pdfa-7.0.0.Jar).

Any help is much appreciated, I am really stuck and can't seem to find any help in previous posts.

Thanks

It looks like there should be an Itext-Layout-7.0.0.jar file that you can import those needed classes from.

They have significantly changed the internal dependencies for version 7 

I think this needs 

import com.itextpdf.layout.element.BlockElement too

if you read their API docs you will find the dependencies. I am just getting my head round modifying all my 5.+ code for the v 7 libraries - and waiting for 306works to update the plunging as this only work on a PC due to the Java 6 dependancy on Mac

  • Author
  • Newbies

Thank you both for your help with this - it looks like that will solve the problem that I was running into. And John - I had missed the dependencies when I was reading through the APIs i'm sure that will be helpful too; appreciate your advice.

Feel free to post questions (or answers).. this is my area of some expertise..

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.