使用php将pdf转换为灰度的最佳方法? [英] Best way to convert pdf to greyscale with php?

查看:23
本文介绍了使用php将pdf转换为灰度的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想将 pdf 转换为灰度,最好的方法是什么.我目前使用 tcpdf 将 html 转换为 pdf,但我还需要一个可以将其转换为灰度的选项.这样做的最佳方法是什么.

If I want to convert a pdf to greyscale whats the best way to go about it. Im currently using tcpdf to convert html to pdf but I also need an option where I can convert it to greyscale. Whats the best way to go about doing this.

推荐答案

如果你有 Imagick (imagemagick) 已安装,您可以将生成的 PDF 保存为另一个灰度.

If you have Imagick (imagemagick) installed, you can take your generated PDF and save another gray-scaled one.

$image = new Imagick('generatedPDF.pdf');
$image->setColorspace(imagick::COLORSPACE_GRAY);
$image->writeImage('newPic.pdf');
$image->clear();
$image->destroy();

这篇关于使用php将pdf转换为灰度的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆