0

我正在尝试使用 Imagick 将 pdf 转换为图像并打印多页。我遇到的问题是使用标题(“Content-Type: image/jpeg”);对于每一页。它只会打印第一页。完成后,图像被设置为页面的背景。我的代码如下所示:

$im = new imagick('filename.pdf');
$im->setImageFormat( "jpg" );

header( "Content-Type: image/jpeg" );
for ($i = 0; $i < $im->getNumberImages(); $i++) {

    $temp_image=new imagick("iptlock_media/files/s8czV4rz4Ge5YMFKsLSu.pdf[$i]");
    $temp_image->setImageFormat( "jpg" );
    echo $temp_image;
}//end foreach

谁能建议如何解决这个问题?

4

1 回答 1

0

It looks like you are trying to output several jpeg images to one header, which I don't think is possible. Have you considered outputting the images to file and then outputting HTML to display all the images?

于 2011-03-04T14:11:10.483 回答