开发者

pdftk in php not working

开发者 https://www.devze.com 2023-03-18 19:41 出处:网络
here is the code.... it is not able to merge two pdf files ...can anyone find what 开发者_Go百科the problem is in the code... thanks for ur time....You\'re using the wrong syntax.

here is the code.... it is not able to merge two pdf files ...can anyone find what 开发者_Go百科the problem is in the code... thanks for ur time....


You're using the wrong syntax.

Right code should looks like such this:

// prepare command escaping paths of your files
$parts = '';
foreach( array( 'file1.pdf', 'file2.pdf' ) as $part )
    $parts .= escapeshellarg( $part ) . ' ';

// build command
$command = sprintf( 'pdftk %s cat output %s', $parts, escapeshellarg($output) );

// launch it
system( $command, $returnvalue );
if( $returnvalue )  printf 'There was an error.';

Next time note: please choose a more-specific title and remove unnecessary code.

0

精彩评论

暂无评论...
验证码 换一张
取 消