打印多种内容标题类型
我正在尝试使用 Imagick 将 pdf 转换为图像并打印多页。我遇到的问题是使用 header( "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
任何人都可以建议如何解决此问题吗?
I am trying to convert a pdf into an image using Imagick and print multiple pages. The problem I am running into is using the header( "Content-Type: image/jpeg" ); for each page. It will only print the first page. When finished the image is set to a background to a page. My code looks like this:
$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
Can anyone please advise how to resolve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您正在尝试将多个 jpeg 图像输出到一个标头,我认为这是不可能的。您是否考虑过将图像输出到文件,然后输出 HTML 以显示所有图像?
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?