473,493 Members | 3,174 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 3201
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3597
by: cc | last post by:
From the popular website At this link: http://www.w3schools.com/asp/asp_globalasa.asp I got this code, but it does not work on my server... I can open three IE browsers and watch the count go to...
2
2229
by: TGOS | last post by:
Here's a little question to MySQL Gurus. Two tables. One called 'document' one called 'page'. Needles to say, a document consist out of multiple pages (1:n). The primary (P) and foreign (F) keys...
2
4515
by: L Mehl | last post by:
Different users of the app will want or not want to see report footer ( appears as a separate page). I can make the section invisible with a DLookup of a Y or N value from a 'parameters' table ...
2
1622
by: danny_m | last post by:
Hi there I have two tables, pages and sections, of which pages are a subset of sections. I'm listing out the sections in a list and want to include a COUNT of how many pages each section has...
2
7905
by: john | last post by:
In groupheader in my report I would like to have a page count like "1 of 3" independent from the report's page count (every new item in the group starts on a new page). So the group that start on...
6
5812
by: C10B | last post by:
hi, I have a table with several million rows. Each row is simply the date and time a certain page was viewed. eg page1 1-1-00 page2 2-1-00 page1 16-1-00 page1 17-1-00
2
3230
by: thvferrari | last post by:
Hey guys, Does anyone of you know how to count the number of pages that a doc, xls and ppt would print? My objective is to count this number of pages and charge the user per number of pages...
4
13070
by: G E W hittle | last post by:
I have a directory of tiff files. I need to loop thru the files and count the number of pages in each file. Can someone point me to where this info is stored? GW
1
5032
by: rakesh kakarla | last post by:
Hey guys, Does anyone of you know how to count the number of pages that A HTML page would print. My objective is to count the number of pages in an HTML page using javascript. my application...
2
7894
by: bling via DotNetMonster.com | last post by:
greetings fellow programmers!! im kinda new in vb.net and i need your professional help! im using DSOframer to open .doc files but i disabled the menubar and toolbar because i just want to show...
0
6989
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7195
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6873
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7367
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5453
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4889
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
644
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.