Access Finder More Info on PDF pages count

Hi All,

First post, any help or pointers appreciated. All searching has failed to uncover how to access the page count, dimensions and other information that is displayed in the Get Info window, More Info Pane, for a PDF in the finder. I have search here and Google generally and scanned the dictionary of Finder and Scripting Additions, no clues.

What I am try to get is access to some of the properties displayed when you use the Get Info option in the Finder on a PDF document. In the More Info pane there is specific PDF properties, Title, Version, Pages, Dimensions etc. I need to extract and use these in my AppleScript. Help with syntax or at least correct AS dictionary would be great. Thanks.

You need to use “do shell script” and the mdls command. If you open terminal and type "mdls " and then drag in a PDF, you’ll see the information it returns.

Hi Rob

You could use this code to get all that data

set my_PDF to POSIX path of (choose file without invisibles)
do shell script "mdls " & quoted form of my_PDF

and use it something like this mybe

set _itempath to "PATH TO YOUR PDF"

set _H to do shell script "mdls -name kMDItemPageHeight " & quoted form of POSIX path of _itempath

set _W to do shell script "mdls -name kMDItemPageWidth " & quoted form of POSIX path of _itempath

set _Result to {_H, _W}

Hope this helps out

Brilliant, thanks to Shane& Budgie, uncovering the power under the hood of OS X, problem solved.

Model: UB MBP 17inch
AppleScript: 2.1.2
Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)