Hi,
Paul suggested that he had not implemented the "NumberPages". Would the code
below work? It works so far on everything I have tested. I got it from the
internet but can't find who wrote it - sorry.
"""
This module contains a function to count
the total pages for a PDF file.
I'm using Paul's invoice.pdf for testing
"""
from glob import glob as __g
from re import search as __s
def count():
vFileOpen = open( '/home/johnf/daboreports/invoice.pdf', 'rb', 1 )
for vLine in vFileOpen.readlines():
if "/Count " in vLine:
vPages = int( __s("/Count \d*", vLine).group()[7:] )
break
print vPages
vFileOpen.close()
#
#cdef double tf = __c() #Used for benchmark.
#
#print tf-ti
return vPages
#
if __name__ == "__main__":
count()
--
John Fabiani
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]