def pageCount(pdfPath):
    "Return the number of pages for some PDF file."

    data = NSData.dataWithContentsOfFile_(pdfPath)
    img = NSPDFImageRep.imageRepWithData_(data)
    return img.pageCount()
Return the number of pages for some PDF file.
recipes/Python/286219_Counting_pages_PDF_documents_Mac_OS/recipe-286219.py