datatracker/ietf/utils/pdf.py
Ole Laursen acda84208d Summary: Make the meeting agenda code use the historic info available
for groups. In the process, added some select_related/prefetch_related
code to cut the number of database queries in the agenda down from
4000-5000 to about 50. Rewritten agenda CSV code to use Python arrays
rather than a template for improved readability/reuse. Rewritten week
view to assemble its data in Python. Plus a few other minor cleanups,
e.g. lame_description is now gone.

Fixes #1088. Branch ready for merge.
 - Legacy-Id: 9669
2015-06-17 13:37:16 +00:00

15 lines
299 B
Python

import re
def pdf_pages(filename):
"""Return number of pages in PDF."""
try:
infile = open(filename, "r")
except IOError:
return 0
for line in infile:
m = re.match('\] /Count ([0-9]+)',line)
if m:
return int(m.group(1))
return 0