📅  最后修改于: 2022-03-11 14:45:33.950000             🧑  作者: Mango
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'])