Jump to content

Getting The Dpi/ppi Of Images In A Pdf


EvilMonkeySlayer

Recommended Posts

I've had an idea for a site (something to create and maybe propose at work), one of those bits for the site is the ability to upload a PDF and run flight check on it.Essentially I want to be able to have say a user set DPI/PPI limit for PDF's, a user uploads a PDF, a check is then run against all images in the PDF making sure they're above a set PPI (say 150). Now, you can extract the images using a tool such as pdfimages.. but I don't know of a way to analyse a PDF in such detail. Essentially if any images are below the set DPI/PPI then it would say output a warning/error with the displayed image saying something along the lines of "warning, this images DPI is too low (75dpi) and the current accepted minimum is 150dpi.".I guess something that could determine a. the page size, b. the size of the image on the page and c. the images pixel size. (i've looked at PDF's and the pixel size is easy enough to pick up, but i'd have to read up the PDF standard to determine where it stores the page size and the size of the images on the document itself)Using those three a PPI for an image could be calculated.I've had a cursory look of FPDF, FPDI, TCPDF and PDFLib. From what I can determine none of these have the ability to do what I want, since they seem to be focused more on the creation of a PDF rather than interrogating it. (probably)Now, I'm still very much learning PHP so I can't say I'm all too hot on the idea of writing some kind of PDF parser since I've never done that kind of thing before and also because I'm so new to PHP.Does anyone know of something like FPDF etc that could parse/analyse a PDF for image information on PPI etc?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...