Show
Ignore:
Timestamp:
04/04/05 00:28:37 (19 years ago)
Author:
jerome
Message:

Moved the code into the submodules

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/pdlanalyzer/pdf.py

    r191 r193  
     1#! /usr/bin/env python 
     2# -*- coding: ISO-8859-15 -*- 
    13# 
    24# pkpgcounter : a generic Page Description Language parser 
     
    1921# $Id$ 
    2022# 
     23 
     24import sys 
     25import re 
     26 
     27from pdlanalyzer.pdlparser import PDLParser 
     28 
     29class PDFParser(PDLParser) : 
     30    """A parser for PDF documents.""" 
     31    def getJobSize(self) :     
     32        """Counts pages in a PDF document.""" 
     33        regexp = re.compile(r"(/Type) ?(/Page)[/ \t\r\n]") 
     34        pagecount = 0 
     35        for line in self.infile.xreadlines() :  
     36            pagecount += len(regexp.findall(line)) 
     37        return pagecount     
     38         
     39def test() :         
     40    """Test function.""" 
     41    raise RuntimeError, "Not implemented !" 
     42     
     43if __name__ == "__main__" :     
     44    test()