b300331
--- pdftk/pdftk.cc	2009-04-09 18:07:27.000000000 +0100
Jochen Schmitt 751bd83
+++ pdftk/pdftk.cc	2009-04-09 18:09:20.000000000 +0100
b300331
@@ -2669,6 +2669,44 @@
b300331
 			 strcmp( argv[ii], "-h" )== 0 );
b300331
 	}
b300331
 
b300331
+  {
b300331
+    // Set up CLASSPATH so that we can find property files in
b300331
+    // itext.jar.  Do this the official way, calling build-classpath.
b300331
+
b300331
+    char new_classpath[4096];
b300331
+    char itext_classpath[1024];
b300331
+    char *environ_classpath = getenv ("CLASSPATH");
b300331
+
aa7ef00
+    FILE *p = popen ("/usr/bin/build-classpath itext bcprov bcmail bctsp", "r");
b300331
+    if (!p)
b300331
+      {
aa7ef00
+        perror ("Can't popen /usr/bin/build-classpath itext bcprov bcmail bctsp");
b300331
+        exit (1);
b300331
+      }
b300331
+
b300331
+    char *s = fgets(itext_classpath, sizeof itext_classpath, p);
b300331
+    if (!s)
b300331
+      {
aa7ef00
+        perror ("Can't get ouput from /usr/bin/build-classpath itext bcprov bcmail bctsp");
b300331
+        exit (1);
b300331
+      }
b300331
+
b300331
+    char *nl = strchr (itext_classpath, '\n');
b300331
+    if (nl)
b300331
+      *nl = 0;
b300331
+
b300331
+    pclose (p);
b300331
+
b300331
+    strcpy (new_classpath, "CLASSPATH=");
b300331
+    strncat (new_classpath, itext_classpath, sizeof new_classpath);
b300331
+    if (environ_classpath)
b300331
+      {
b300331
+        strncat (new_classpath, ":", sizeof new_classpath);
b300331
+        strncat (new_classpath, environ_classpath, sizeof new_classpath);
b300331
+      }
b300331
+    putenv (new_classpath);
b300331
+  }
b300331
+
b300331
 	if( help_b ) {
b300331
 		describe_full();
b300331
 	}