count number of pages in pdf python pdfminer code example
Example: count number of pages in pdf python pdfminer
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfinterp import resolve1
file = open('some_file.pdf', 'rb')
parser = PDFParser(file)
document = PDFDocument(parser)
# This will give you the count of pages
print(resolve1(document.catalog['Pages'])['Count'])