Answers for "count number of pages in pdf python pdfminer"

0

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'])
Posted by: Guest on March-03-2021

Code answers related to "count number of pages in pdf python pdfminer"

Python Answers by Framework

Browse Popular Code Answers by Language