Getting a java.io.CharConversionException with pdftk while using MAMP?Posted on: 2010-02-05 10:08:10
Man, talk about a frustrating problem! I kept getting this errors while calling pdftk (from the mac installer, which the version as of this writing is 1.12):
Unhandled Java Exception:
Anyway, after much hair pulling, the answer was found! Before calling "shell_exec":http://php.net/shell_exec (or whatever function you use to call pdftk) you need to unset the
DYLD_LIBRARY_PATH environment variable.
<code lang="php"># unset this so pdftk will work! putenv('DYLD_LIBRARY_PATH');
put the output in a variable
$pdf_data = shell_exec('/usr/local/bin/pdftk '. $file_name .' fill_form '. $fdf_fn. ' output - flatten');