在 php 中动态创建 PDF,支持 16 位颜色深度 png
我正在尝试在应用程序中动态创建 pdf 文档,即用户单击链接,然后会向他们显示包含一些文本和一些图像的 pdf 文档。
我目前正在使用 FPDF v1.6 (http://www.fpdf.org/),它支持24 位(真彩色)png,但我遇到的问题是,这是一个遗留应用程序,有 1000 个 16 位颜色深度的 png,FPDF 不支持,而且我无法简单地进行转换,因为应用程序的其他部分使用这些图像。
我看到的唯一解决方案是:
- 即时转换 16 位 png 图像并将其嵌入到 pdf 中。
- 找到一个新的 pdf 类,它将接受 16 位颜色深度 png。
有人有什么想法吗?
I'm trying to create pdf documents on the fly in an application, i.e. a user clicks a link and a pdf document is displayed to them with some text and some images.
I'm currently using FPDF v1.6 (http://www.fpdf.org/) which supports 24bit (true colour) png's but the problem I have is that this is a legacy application and there's 1000's of png's that are of 16bit colour depth which FPDF does not support and I can't simply convert due to other parts of the application using these images.
The only solutions I see are:
- convert the 16bit png image on the fly and embed that into the pdf.
- find a new class pdf class that will accept 16bit colour depth png's.
Anyone have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许您可以尝试使用 TCPDF (从未将其与 16 位 PNG 一起使用,但应该很容易测试它)。
Maybe you could try using TCPDF (never used it with 16bit PNGs but it should be easy to test it).
在 python 中修复了这个问题:
Fixed with this in python: