如何在PHP中获取PDF中的图像的DPI,宽度和长度 [英] How to get DPI, width and length of an image in PDF in PHP

查看:87
本文介绍了如何在PHP中获取PDF中的图像的DPI,宽度和长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设将单个图像另存为pdf.如何获取有关PDF文件中图像的DPI,宽度和长度信息?如何在PHP中做到这一点?基本上,我想检索以下信息:

Suppose a single image is saved as pdf. How can I get DPI, width and length information about the image in PDF file? How can I do it in PHP? Basically I want to retrieve the following information:

输入文件的大小:285.81 KB 导入时间:0秒 源文档已使用Adobe Photoshop CS4 Macintosh创建

Size of input file: 285.81 KB Import time: 0 sec Source document has been created with Adobe Photoshop CS4 Macintosh

PDF文件已使用Macintosh的Adobe Photoshop生成-图像转换插件 创作

PDF file has been produced using Adobe Photoshop for Macintosh -- Image Conversion Plug-in Creation

原始文档的日期是:D:20091002102636 + 05'30'

date of source document is: D:20091002102636+05'30'

导入时识别的页面格式:自定义( 2.997厘米x 5.004厘米)

Recognized page format at import: Custom (2.997 cm x 5.004 cm)

文档包含 1页.

以下文件属性可能会导致问题: Page 1(Image4:位置x:1.499 cm y:2.502 cm,宽度:2.997 cm高度:5.004 cm):灰度图像分辨率太高(发现:300.00 dpi -要求:170.00 dpi)

The following file properties may cause problems: Page 1 (Image4: Pos. x: 1.499 cm y:2.502 cm, width: 2.997 cm height: 5.004 cm): Resolution of grayscale image too high (found: 300.00 dpi - demanded: 170.00 dpi)

推荐答案

DPI与PDF本身无关.您关心的是其中嵌入的图像,为了轻松解析它们,您可能希望使用为您处理文件IO的库进行重建,例如 http://www.pdflib.com

DPI is irrelevant in PDFs themselves. Your concern is with an image embedded within it, and to parse those out easily you will probably want to rebuild with a library that handles the file IO for you, such as http://www.pdflib.com

这篇关于如何在PHP中获取PDF中的图像的DPI,宽度和长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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