469,358 Members | 1,617 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

PDF count pages

Hi there,

Does anyone know how I could do in order
to get/count the number of pages of a PDF file? (from
python of course ;) )

Thanks beforehand.

Cheers,
Jose

--

Jose Benito Gonzalez Lopez

CERN Document Server ** <http://cds.cern.ch/> ** <cds.support @ cern.ch>
InDiCo Project ** <http://indico.cern.ch> ** <indico-project @ cern.ch>
CDSconv ** <http://cdsconv.cern.ch>
Room: Bldg 513-R-027 ** Voice: +41 22 76 78893

Jul 18 '05 #1
4 2991
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
Jul 18 '05 #2
Andreas Lobinger wrote:

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 ?

[...]
>>> import pdffile
>>> pf = pdffile.pdffile('../rfc1950.pdf')
>>> import pages
>>> pp = pages.pages(pf)
>>> len(pp.pagelist) [...]

That's interesting. Here's my equivalent example:

Python 2.3.3 (#1, May 2 2004, 15:04:07)
[GCC 3.2.2] on linux2
Type "help", "copyright", "credits" or "license" for more information. from pdftools import pdffile
doc = pdffile.PDFDocument("PDFSPEC.pdf")
doc.count_pages()

518

The API shown above is from an unreleased version of pdftools
(http://www.boddie.org.uk/david/Proje...hon/pdftools/).
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.


I browsed the code in CVS and it looks like a pretty comprehensive
implementation. Maybe we should join forces.

David

Jul 18 '05 #3
Andreas Lobinger wrote:

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 ?

[...]
>>> import pdffile
>>> pf = pdffile.pdffile('../rfc1950.pdf')
>>> import pages
>>> pp = pages.pages(pf)
>>> len(pp.pagelist) [...]

That's interesting. Here's my equivalent example:

Python 2.3.3 (#1, May 2 2004, 15:04:07)
[GCC 3.2.2] on linux2
Type "help", "copyright", "credits" or "license" for more information. from pdftools import pdffile
doc = pdffile.PDFDocument("PDFSPEC.pdf")
doc.count_pages()

518

The API shown above is from an unreleased version of pdftools
(http://www.boddie.org.uk/david/Proje...hon/pdftools/).
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.


I browsed the code in CVS and it looks like a pretty comprehensive
implementation. Maybe we should join forces.

David

Jul 18 '05 #4
Aloha,

da****@mcs.st-and.ac.uk wrote:
Andreas Lobinger wrote:
>>> import pdffile

I browsed the code in CVS and it looks like a pretty comprehensive
implementation. Maybe we should join forces.


I have problems contacting you via the given e-mail adress.

Wishing a happy day
LOBI
Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by TGOS | last post: by
2 posts views Thread by danny_m | last post: by
2 posts views Thread by john | last post: by
4 posts views Thread by G E W hittle | last post: by
2 posts views Thread by bling via DotNetMonster.com | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.