I am using pdftk
library for modify the pdf files. but i am getting the chmod(): Invalid argument
error.
Following is my code :
include('fillpdf/createXFDF.php');
$fdf_file = 'fillpdf/acord.fdf';
$acord = array();
$acord['******'] = 'a';
$acord['******'] = 'a';
$pdf_file_url = 'http://localhost/******/fillpdf/Cancellation.pdf';
$fdf = createXFDF( $pdf_file_url, $acord );
// print_r($fdf); die;
if ($fp = fopen($fdf_file, 'w')) {
chmod($fdf, 777);
fwrite($fp, $fdf, strlen($fdf));
$CREATED = TRUE;
} else {
echo 'Unable to create file: ' . $fdf_file . '<br><br>';
$CREATED = FALSE;
}
// var_dump($CREATED); die;
fclose($fp);
$command = '"C:\\Program Files (x86)\\PDFtk\\bin\\pdftk.exe" C:\\xampp\\htdocs\\*******\\fillpdf\\Cancellation.pdf fill_form acord.fdf output C:\\xampp\\htdocs\\*******\\fillpdf\\Cancellation_new.pdf';
exec($command);
I have given all the necessary permission to folder and files. but don't know what is wrong??
Thanks in advance!!!
Why you need to give
chmod($fdf,0777);
to$fdf
. It's not even the file. as per your code the$fdf = createXFDF( $pdf_file_url, $acord );
is calling function and it's not file. so just comment thechmod($fdf,0777);
line and check your code is working or not??Hope it helps!!!