Display PDF version metadata of a PDF file

Solution 1:

Phil Harvey's exiftool could be wrapped in a AppleScript droplet. As an example of the command:

exiftool -S -pdfversion FILE

Solution 2:

Normally, the PDF version number and other metadata should be available in the "More Info" section of the Get Info pane. (This includes Title, Author, Page count, Page size, Security/encryption settings, Content Creator and Encoding Software.) If you're not seeing that, then your Spotlight index probably needs re-indexing.

enter image description here

It is possible to query the PDF version info directly without any third-party tools. The following python script will list a variety of metadata from any PDF document(s) supplied as an argument.

#! /usr/bin/python
# -*- coding: utf-8 -*-

import sys
from Quartz import PDFDocument
from Foundation import NSURL

if __name__ == '__main__':

    for filename in sys.argv[1:]:
        filename = filename.decode('utf-8')
        pdfURL = NSURL.fileURLWithPath_(filename)
        pdfDoc = PDFDocument.alloc().initWithURL_(pdfURL)
        if pdfDoc:
            print "URL:", pdfDoc.documentURL()
            metadata = pdfDoc.documentAttributes()
            for key in metadata:
                print "{}: {}".format(key, metadata[key])
            print "Number of Pages:", pdfDoc.pageCount()
            print "Is Encrypted:", pdfDoc.isEncrypted()
            print "Is Locked:", pdfDoc.isLocked()
            print "Allows Copying:", pdfDoc.allowsCopying()
            print "Allows Printing:", pdfDoc.allowsPrinting()
            print "Version: {}.{}".format(pdfDoc.majorVersion(),pdfDoc.minorVersion())
        else: print "Cannot get this file. (Not a PDF? / Bad filename?)"