0

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
KSMS
  • 1
  • 2
  • Check that the permissions on `pdftk`, the PDF file you're trying to access, the folder that it's in, and the "current working directory" (where your output file will go, since you haven't provided a full path for it) are all such that your web service (e.g. Apache or nginx) can access them. – Greg Schmidt Aug 05 '19 at 18:13

1 Answers1

0

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
Vikas Verma
  • 149
  • 1
  • 11