Index: pykota/trunk/LICENSE
===================================================================
--- pykota/trunk/LICENSE (revision 1257)
+++ pykota/trunk/LICENSE (revision 1622)
@@ -29,5 +29,6 @@
     Then follow the instructions in the section labeled "Getting a Copy of the CVS Repository". 
 
-  * Clients who purchased an **Official PyKota Package** can directly access to "the tarballs HERE":/software/PyKota/tarballs .
+  * Clients who purchased an **Official PyKota Package** can directly access to "the tarballs HERE":
+http://www.librelogiciel.com/software/PyKota/tarballs .
                
 Why no tarball is available for free :
@@ -63,5 +64,5 @@
     * Electronic form :
 
-      * You pay me any amount of money starting at **15$ (US Dollars)**
+      * You pay me any amount of money starting at **20$ (US Dollars)**
 
       * Then I send you the latest **PyKota 'OFFICIAL'** tarball, 
Index: pykota/trunk/conf/pykota.conf.sample
===================================================================
--- pykota/trunk/conf/pykota.conf.sample (revision 1604)
+++ pykota/trunk/conf/pykota.conf.sample (revision 1622)
@@ -287,5 +287,5 @@
 #                 pkpgcounter is a command line tool which is
 #                 part of PyKota and which can handle both
-#                 DSC compliant PostScript, PCL5, PCL6 (aka PCLXL)
+#                 DSC compliant or binary PostScript, PCL5, PCL6 (aka PCLXL)
 #                 and PDF documents. More file formats will be added
 #                 in the future, as time permits.
Index: pykota/trunk/README
===================================================================
--- pykota/trunk/README (revision 1612)
+++ pykota/trunk/README (revision 1622)
@@ -69,6 +69,6 @@
           This is completely configurable.
           
-        - Supports DSC compliant PostScript, PDF, PCL5, and
-          PCLXL (aka PCL6) printers natively for software 
+        - Supports DSC compliant and binary PostScript, PDF, PCL5, 
+          and PCLXL (aka PCL6) printers natively for software 
           accounting methods. More formats to come.
             
Index: pykota/trunk/FAQ
===================================================================
--- pykota/trunk/FAQ (revision 1578)
+++ pykota/trunk/FAQ (revision 1622)
@@ -78,7 +78,8 @@
     Page Description Language.
     
-    PyKota natively understands PostScript, PCL5, PCLXL (aka PCL6)
-    and PDF. More PDLs will be added in the future. However you can 
-    always plug your own PDL analyzer in PyKota.
+    PyKota natively understands DSC compliant PostScript, PCL5, 
+    PCLXL (aka PCL6) and PDF. Support for Binary PostScript is
+    done through GhostScript. More PDLs will be added in the future. 
+    However you can always plug your own PDL analyzer in PyKota.
           
   * I've got a great number of users. How can I automatically
Index: pykota/trunk/pykota/pdlanalyzer.py
===================================================================
--- pykota/trunk/pykota/pdlanalyzer.py (revision 1599)
+++ pykota/trunk/pykota/pdlanalyzer.py (revision 1622)
@@ -22,4 +22,9 @@
 #
 # $Log$
+# Revision 1.26  2004/07/22 13:49:51  jalet
+# Added support for binary PostScript through GhostScript if native DSC
+# compliant PostScript analyzer doesn't find any page. This is much
+# slower though, so native analyzer is tried first.
+#
 # Revision 1.25  2004/07/10 14:06:36  jalet
 # Fix for Python2.1 incompatibilities
@@ -108,4 +113,5 @@
 import tempfile
 import mmap
+import popen2
     
 KILOBYTE = 1024    
@@ -125,7 +131,36 @@
         """Initialize PostScript Analyzer."""
         self.infile = infile
-        
-    def getJobSize(self) :    
+       
+    def throughGhostScript(self) :
+        """Get the count through GhostScript, useful for non-DSC compliant PS files."""
+        self.infile.seek(0)
+        command = 'gs -sDEVICE=bbox -dNOPAUSE -dBATCH -dQUIET - 2>&1 | grep -c "%%HiResBoundingBox:" 2>/dev/null'
+        child = popen2.Popen4(command)
+        try :
+            data = self.infile.read(MEGABYTE)    
+            while data :
+                child.tochild.write(data)
+                data = self.infile.read(MEGABYTE)
+            child.tochild.flush()
+            child.tochild.close()    
+        except (IOError, OSError), msg :    
+            raise PDLAnalyzerError, "Problem during analysis of Binary PostScript document."
+            
+        pagecount = 0
+        try :
+            pagecount = int(child.fromchild.readline().strip())
+        except (IOError, OSError, AttributeError, ValueError) :
+            raise PDLAnalyzerError, "Problem during analysis of Binary PostScript document."
+        child.fromchild.close()
+        
+        try :
+            retcode = child.wait()
+        except OSError, msg :    
+            raise PDLAnalyzerError, "Problem during analysis of Binary PostScript document."
+        return pagecount
+        
+    def natively(self) :
         """Count pages in a DSC compliant PostScript document."""
+        self.infile.seek(0)
         pagecount = 0
         for line in self.infile.xreadlines() : 
@@ -133,4 +168,8 @@
                 pagecount += 1
         return pagecount
+        
+    def getJobSize(self) :    
+        """Count pages in PostScript document."""
+        return self.natively() or self.throughGhostScript()
         
 class PDFAnalyzer :
Index: pykota/trunk/pykota/version.py
===================================================================
--- pykota/trunk/pykota/version.py (revision 1611)
+++ pykota/trunk/pykota/version.py (revision 1622)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.19alpha34_unofficial"
+__version__ = "1.19alpha35_unofficial"
 
 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""
Index: pykota/trunk/man/pkpgcounter.1
===================================================================
--- pykota/trunk/man/pkpgcounter.1 (revision 1575)
+++ pykota/trunk/man/pkpgcounter.1 (revision 1622)
@@ -14,7 +14,8 @@
 \fBpkpgcounter\fP is a convenience script provided by pykota that attempts
 to count the number of pages in a DSC compliant PostScript, PDF, PCL5 or 
-PCL6 (aka PCLXL) document. This may be of use
-as an external accounter as defined in /etc/pykota/pykota.conf, since currently
-\fBpkpgcounter\fP is the smarter software accounter included with PyKota.
+PCL6 (aka PCLXL) document. Binary PostScript is also supported through 
+GhostScript. This may be of use as an external accounter as defined in 
+/etc/pykota/pykota.conf, since currently \fBpkpgcounter\fP is the smarter 
+software accounter included with PyKota.
 
 \fBpkpgcounter\fP with no argument reads the job's data from stdin, and prints
Index: pykota/trunk/NEWS
===================================================================
--- pykota/trunk/NEWS (revision 1611)
+++ pykota/trunk/NEWS (revision 1622)
@@ -22,4 +22,9 @@
 PyKota NEWS :
 
+    - 1.19alpha35 :
+    
+        - Generic PDL analyzer now supports Binary PostScript documents
+          in addition to DSC compliant ones.
+        
     - 1.19alpha34 :
     
