DOMPDF 图像质量
我想知道为什么 DOM PDF 中的图像质量较低。
如下图: http://img517.imageshack.us/img517/6996/top3.gif
边框为 1 像素,一切看起来都很清晰。
如果我使用 DOMPDF 将图像包含在 HTML 文档中,一切都很好,但图像的质量不是很清晰。
输出: img88.imageshack.us/img88/3801/screenshot20100625at110.png
我将其包含在以下代码中:
<p><img src="img/pdf/top.gif" /></p>
I would like to know why the quality of my image is low in DOM PDF.
The following image:
http://img517.imageshack.us/img517/6996/top3.gif
The borders are 1px and everything looks sharp.
If I include the image in a HTML document with DOMPDF, everything works great, but the quality of the image is not really sharp.
Output:
img88.imageshack.us/img88/3801/screenshot20100625at110.png
I'm including it with the following code:
<p><img src="img/pdf/top.gif" /></p>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能只是 PDF 在屏幕上显示方式的问题。如果将 DOMPDF_DPI 值设置为与图像相同,则图像尺寸与其在文档中的尺寸之间应该存在一一对应的关系(尝试使用值 72)。我敢打赌,除非您查看 PDF 的缩放级别使得屏幕和 PDF 之间的 DPI 完全匹配,否则图像看起来不会很正确,因为需要缩放。
您的 PDF 看起来像是要打印的文件,您是否尝试过将其打印出来以检查质量?如果看起来不太好,您可以尝试调整 DOMPDF_DPI 的值和/或指定图像的尺寸。
This could just be a problem with how the PDF is displayed on the screen. If you set your DOMPDF_DPI value to the same as the image, then there should be a one-to-one correspondence between the image dimensions and its dimensions in the document (try a value of 72). I'd wager that unless the zoom level at which you are viewing the PDF is such that the DPI matches exactly between the screen and the PDF that the image will not look quite right since it will need to be scaled.
Your PDF looks like something that is intended to be printed, have you tried printing it out to check the quality? If it doesn't look good you might try adjusting the value of DOMPDF_DPI and/or specifying dimensions of the image.