sh: /usr/bin/pdftk: No such file or directory

2.5k Views Asked by At

I am trying to extract PDF form details using PDFTK sever but I am getting an error sh: /usr/bin/pdftk: No such file or directory when executing from PHP with help of exec and exec_shell both function. I tried with full path but still shows me the same error.

I have tried with setting envput() function but no luck.

below is command which is executing from PHP exec and exec_shell functions, this command worked expected when execute it from terminal (OS : CentOS).

/usr/bin/pdftk /home/www/public_html/webroot/tmp/client_import_form_filled.pdf dump_data_fields_utf8 2>&1

I am expecting PDF form extracted data as below

FieldType: Text
FieldName: ClientFirstName
FieldFlags: 2
FieldValue: Kevin
FieldJustification: Left
1

There are 1 best solutions below

0
Vikas Verma On

You must install pdftk on your server then you can simply use pdftk instead of /usr/bin/pdftk

/usr/bin/pdftk /home/www/public_html/webroot/tmp/client_import_form_filled.pdf 
dump_data_fields_utf8 2>&1

to

pdftk /home/www/public_html/webroot/tmp/client_import_form_filled.pdf 
dump_data_fields_utf8 2>&1