PDF count pages

Andreas Lobinger andreas.lobinger at netsurf.de
Mon Dec 6 11:01:07 CET 2004


Aloha,

Jose Benito Gonzalez Lopez wrote:
> Does anyone know how I could do in order
> to get/count the number of pages of a PDF file? 

Like this ?
Python 2.2.2 (#3, Apr 10 2003, 17:06:52)
[GCC 2.95.2 19991024 (release)] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
 >>> import pdffile
 >>> pf = pdffile.pdffile('../rfc1950.pdf')
 >>> import pages
 >>> pp = pages.pages(pf)
 >>> len(pp.pagelist)
10
 >>>

This is an example of the usage of pdfplayground. pdfplayground
is available via sourceforge. There is no package at the
moment, but you should be able to check out via anon-cvs.

Wishing a happy day
		LOBI



More information about the Python-list mailing list