Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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'])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #count #number #pages #pdf #python #pdfminer
ADD COMMENT
Topic
Name
6+7 =