I have an existing web app that uses PHP and MySQL. One of the PHP scripts uses a program called pdftk (http://www.accesspdf.com/pdftk/
) to merge multiple pdf files into one pdf file.
If I use the following code, it works perfectly. But in the following code, I have to name a specific output file. I want to use a variable to define the output pdf filename.
I have also listed the code that I have tried to use a PHP variable, but it does not work.
Any ideas on how I can use a variable to name the output file?
This is the working code, but uses a static filename for the output file (final.pdf):
passthru('/pdftk /singles/*.pdf cat output /singles/final.pdf');
This is the code that I tried to use a variable to define the output file name, but does not work:
$dir = "/final/";
$case = "1800644105";
$final = $dir . $case;
passthru('/pdftk /singles/*.pdf cat output $final ');