understack
understack

Reputation: 11580

How to get DPI, width and length of an image in PDF in 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:

On a particular private website I uploaded my pdf and got following informtaion:

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

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

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

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

Document contains 1 page(s).

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)

Upvotes: 1

Views: 2797

Answers (1)

Azeem.Butt
Azeem.Butt

Reputation: 5861

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

Upvotes: 3

Related Questions