php 中的 pdftk 不工作

发布于 2024-11-18 13:40:12 字数 55 浏览 5 评论 0原文

这是代码...它无法合并两个pdf文件...任何人都可以找到代码中的问题...感谢您的时间...

here is the code.... it is not able to merge two pdf files ...can anyone find what the problem is in the code... thanks for ur time....

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吐个泡泡 2024-11-25 13:40:12

您使用了错误的语法

正确的代码应该如下所示:

// 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.';

下次注意:请选择更具体的标题并删除不必要的代码。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文