Index: pkpgcounter/trunk/tests/colors.pdf
===================================================================
--- pkpgcounter/trunk/tests/colors.pdf (revision 380)
+++ pkpgcounter/trunk/tests/colors.pdf (revision 380)
@@ -0,0 +1,373 @@
+%PDF-1.3
+%���� ReportLab Generated PDF document http://www.reportlab.com
+% 'BasicFonts': class PDFDictionary 
+1 0 obj
+% The standard fonts dictionary
+<< /F1 2 0 R >>
+endobj
+% 'F1': class PDFType1Font 
+2 0 obj
+% Font Helvetica
+<< /BaseFont /Helvetica
+ /Encoding /WinAnsiEncoding
+ /Name /F1
+ /Subtype /Type1
+ /Type /Font >>
+endobj
+% 'Page1': class PDFPage 
+3 0 obj
+% Page dictionary
+<< /Contents 15 0 R
+ /MediaBox [ 0
+  0
+  595.2756
+  841.8898 ]
+ /Parent 14 0 R
+ /Resources << /Font 1 0 R
+  /ProcSet [ /PDF
+   /Text
+   /ImageB
+   /ImageC
+   /ImageI ] >>
+ /Rotate 0
+ /Trans <<  >>
+ /Type /Page >>
+endobj
+% 'Page2': class PDFPage 
+4 0 obj
+% Page dictionary
+<< /Contents 16 0 R
+ /MediaBox [ 0
+  0
+  595.2756
+  841.8898 ]
+ /Parent 14 0 R
+ /Resources << /Font 1 0 R
+  /ProcSet [ /PDF
+   /Text
+   /ImageB
+   /ImageC
+   /ImageI ] >>
+ /Rotate 0
+ /Trans <<  >>
+ /Type /Page >>
+endobj
+% 'Page3': class PDFPage 
+5 0 obj
+% Page dictionary
+<< /Contents 17 0 R
+ /MediaBox [ 0
+  0
+  595.2756
+  841.8898 ]
+ /Parent 14 0 R
+ /Resources << /Font 1 0 R
+  /ProcSet [ /PDF
+   /Text
+   /ImageB
+   /ImageC
+   /ImageI ] >>
+ /Rotate 0
+ /Trans <<  >>
+ /Type /Page >>
+endobj
+% 'Page4': class PDFPage 
+6 0 obj
+% Page dictionary
+<< /Contents 18 0 R
+ /MediaBox [ 0
+  0
+  595.2756
+  841.8898 ]
+ /Parent 14 0 R
+ /Resources << /Font 1 0 R
+  /ProcSet [ /PDF
+   /Text
+   /ImageB
+   /ImageC
+   /ImageI ] >>
+ /Rotate 0
+ /Trans <<  >>
+ /Type /Page >>
+endobj
+% 'Page5': class PDFPage 
+7 0 obj
+% Page dictionary
+<< /Contents 19 0 R
+ /MediaBox [ 0
+  0
+  595.2756
+  841.8898 ]
+ /Parent 14 0 R
+ /Resources << /Font 1 0 R
+  /ProcSet [ /PDF
+   /Text
+   /ImageB
+   /ImageC
+   /ImageI ] >>
+ /Rotate 0
+ /Trans <<  >>
+ /Type /Page >>
+endobj
+% 'Page6': class PDFPage 
+8 0 obj
+% Page dictionary
+<< /Contents 20 0 R
+ /MediaBox [ 0
+  0
+  595.2756
+  841.8898 ]
+ /Parent 14 0 R
+ /Resources << /Font 1 0 R
+  /ProcSet [ /PDF
+   /Text
+   /ImageB
+   /ImageC
+   /ImageI ] >>
+ /Rotate 0
+ /Trans <<  >>
+ /Type /Page >>
+endobj
+% 'Page7': class PDFPage 
+9 0 obj
+% Page dictionary
+<< /Contents 21 0 R
+ /MediaBox [ 0
+  0
+  595.2756
+  841.8898 ]
+ /Parent 14 0 R
+ /Resources << /Font 1 0 R
+  /ProcSet [ /PDF
+   /Text
+   /ImageB
+   /ImageC
+   /ImageI ] >>
+ /Rotate 0
+ /Trans <<  >>
+ /Type /Page >>
+endobj
+% 'Page8': class PDFPage 
+10 0 obj
+% Page dictionary
+<< /Contents 22 0 R
+ /MediaBox [ 0
+  0
+  595.2756
+  841.8898 ]
+ /Parent 14 0 R
+ /Resources << /Font 1 0 R
+  /ProcSet [ /PDF
+   /Text
+   /ImageB
+   /ImageC
+   /ImageI ] >>
+ /Rotate 0
+ /Trans <<  >>
+ /Type /Page >>
+endobj
+% 'Page9': class PDFPage 
+11 0 obj
+% Page dictionary
+<< /Contents 23 0 R
+ /MediaBox [ 0
+  0
+  595.2756
+  841.8898 ]
+ /Parent 14 0 R
+ /Resources << /Font 1 0 R
+  /ProcSet [ /PDF
+   /Text
+   /ImageB
+   /ImageC
+   /ImageI ] >>
+ /Rotate 0
+ /Trans <<  >>
+ /Type /Page >>
+endobj
+% 'R12': class PDFCatalog 
+12 0 obj
+% Document Root
+<< /Outlines 24 0 R
+ /PageMode /UseNone
+ /Pages 14 0 R
+ /Type /Catalog >>
+endobj
+% 'R13': class PDFInfo 
+13 0 obj
+<< /Author (anonymous)
+ /CreationDate (20060828233705)
+ /Producer (ReportLab http://www.reportlab.com)
+ /Subject (unspecified)
+ /Title (untitled) >>
+endobj
+% 'R14': class PDFPages 
+14 0 obj
+% page tree
+<< /Count 9
+ /Kids [ 3 0 R
+  4 0 R
+  5 0 R
+  6 0 R
+  7 0 R
+  8 0 R
+  9 0 R
+  10 0 R
+  11 0 R ]
+ /Type /Pages >>
+endobj
+% 'R15': class PDFStream 
+15 0 obj
+% page stream
+<< /Filter [ /ASCII85Decode
+  /FlateDecode ]
+ /Length 887 >>
+stream
+Gat%!CJ3_B'`BZZ+"lQ)/m9WNc#dK_AOL*,@;uZ!pa)-\::$-B,u*dP^Ya.1
+C:584%.e4Sc:Q=+]pHOQ]ZBf1Q*<g<m"tf5+jGRk?3odI>c.CF0,*l!,4U%r
+Jd`Vrm)=gR&=C`eO!J]HBaI:D_&LH@CJ1`cFL2(GOD<"4j154r+;?5=OSSVE
+4k<Nq>IoJe8o_a+4<<\Wl1c+D5EL>B?Sa$IRe3"g6'hYhaB^5_papRC;2()^
+=[Jg)4[2$o]$=5Y4gWe)C?6-9VJd[(`?]\4r)3]]Q);3/+G#uaYW2_j1!sUG
+>+(QnP@TB=M_q"O+5]@(>B.0KXOmj^br)M&8MFKu10gO*5gG(.M%#eG^@Y9r
+#,O.hXe<h9(g9dE;FkrYLEOKh.D@X_9,+[a\W_er_WWDQN;hA"OMEe2^;K[4
+<RP\)SKr21,4Po$Hd&#<0H,Lp!IS`:?fct<A-<DJpd2@5SVP=/KT69/`J-F]
+_s,gdGX1/S5N]sH$,Wredt-EhKaG1$muP/O]cNcN[1b_AH^>01LOs<>H,9+d
+(G1GppZbph_A^eLUf,[118>5W\+P^%Z>MPM>ZQ8.nS2n^4ejboFisNGZR*j-
+Q5cdSonpl"l;P3VC>JOXKn!lKVPH8r7kfc`IU%A7=dr#k"gW9cLQ-+MK-GO&
+YoeD2?9b[\"ZV0?.UYtFR42#K/0<aKH3"h+O8\q[cAh]rb"6&@mKTs`_SJZJ
+STa(838DUq^q#AcfY-[+d14=`.=5PGG[^?fX0_^+$?dfoDpN="h4K!qee`Qe
+S3X\f\JFX;cn*nIS3YdNm+Nl7b1of>:$4,*A=*H6W.,)e1u1U'39)DLP7c+2
++'AsE@bBT8#I5j(:B~>endstream
+
+endobj
+% 'R16': class PDFStream 
+16 0 obj
+% page stream
+<< /Filter [ /ASCII85Decode
+  /FlateDecode ]
+ /Length 108 >>
+stream
+GapQh0E=F,0U\H3i"VoYmq/M+BVZ3&VI4)3B;,ssUYm'-b6:`Tj:5Z7V=S`h
+JQ\k9VKt_oVIg/N-AHg^(7#^C7B$Vh>.e)I]NbGJW"J\~>endstream
+
+endobj
+% 'R17': class PDFStream 
+17 0 obj
+% page stream
+<< /Filter [ /ASCII85Decode
+  /FlateDecode ]
+ /Length 109 >>
+stream
+GapQh0E=F,0U\H3i"VoYmq/M+BVZ3&VI4)3B;,ssUYm'-b6:`Vj:5Z7V=S`h
+JT[AaRd(cYS!kd.Ql,*k=BJ`T'W!9=C%63mn8\O0AY]q2~>endstream
+
+endobj
+% 'R18': class PDFStream 
+18 0 obj
+% page stream
+<< /Filter [ /ASCII85Decode
+  /FlateDecode ]
+ /Length 109 >>
+stream
+GapQh0E=F,0U\H3i"VoYmq/M+BVZ3&VI4)3B;,ssUYm'-b6:`Xj:5Z7V=S`h
+JT[AaRd(cYS!kd.Ql,*k=BJ`T'W!9=C%63mn8\O0AY9Y.~>endstream
+
+endobj
+% 'R19': class PDFStream 
+19 0 obj
+% page stream
+<< /Filter [ /ASCII85Decode
+  /FlateDecode ]
+ /Length 108 >>
+stream
+GapQh0E=F,0U\H3i"VoYmq/M+BVZ3&VI4)3B;,ssUYm'-b6:aOT\tf;B(L')
+JJk>NVKt_oVIg/N-AHg^(7#^C7B$Vh>.e)I]NbGZG7iL~>endstream
+
+endobj
+% 'R20': class PDFStream 
+20 0 obj
+% page stream
+<< /Filter [ /ASCII85Decode
+  /FlateDecode ]
+ /Length 106 >>
+stream
+GapQh0E=F,0U\H3i"VoYmq/M+BVZ3&VI4)3B;,ssUYm'-b6:i)NF6AiEohii
+VO"**7cpR[$5OtCH579^((*L0$;Od;>RJ,K!-N>pf`~>endstream
+
+endobj
+% 'R21': class PDFStream 
+21 0 obj
+% page stream
+<< /Filter [ /ASCII85Decode
+  /FlateDecode ]
+ /Length 107 >>
+stream
+GapQh0E=F,0U\H3i"VoYmq/M+BVZ3&VI4)3B;,ssUYm'-b6:i+NF6AiEohlF
+R9H'E)4?t_.9MrSl<.4k=st)].QD/4E[gKu!<@7\&_R~>endstream
+
+endobj
+% 'R22': class PDFStream 
+22 0 obj
+% page stream
+<< /Filter [ /ASCII85Decode
+  /FlateDecode ]
+ /Length 107 >>
+stream
+GapQh0E=F,0U\H3i"VoYmq/M+BVZ3&VI4)3B;,ssUYm'-b@LZRkD`k]o5`rD
+RAQ:IH:I%oAdT;#L3aUNQ50frW<uC(]NbfV>QAn^&_R~>endstream
+
+endobj
+% 'R23': class PDFStream 
+23 0 obj
+% page stream
+<< /Filter [ /ASCII85Decode
+  /FlateDecode ]
+ /Length 108 >>
+stream
+GapQh0E=F,0U\H3i"VoYmq/M+BVZ3&VI4)3B;,ssUYm'-b@R=HJ_gZE2D8,Q
+Qsj`DWb5j[C8PBI@]3pJ@;2E3PcEZ;`QP*nb67lg&eW^~>endstream
+
+endobj
+% 'R24': class PDFOutlines 
+24 0 obj
+<< /Count 0
+ /Type /Outlines >>
+endobj
+xref
+0 25
+0000000000 65535 f
+0000000113 00000 n
+0000000209 00000 n
+0000000372 00000 n
+0000000663 00000 n
+0000000954 00000 n
+0000001245 00000 n
+0000001536 00000 n
+0000001827 00000 n
+0000002118 00000 n
+0000002409 00000 n
+0000002701 00000 n
+0000002994 00000 n
+0000003132 00000 n
+0000003330 00000 n
+0000003511 00000 n
+0000004543 00000 n
+0000004796 00000 n
+0000005050 00000 n
+0000005304 00000 n
+0000005557 00000 n
+0000005808 00000 n
+0000006060 00000 n
+0000006312 00000 n
+0000006567 00000 n
+trailer
+<< /ID 
+  % ReportLab generated PDF document -- digest (http://www.reportlab.com) 
+  [(\340\(*\203\347#4m\3439\361`\027\324\364\222) (\340\(*\203\347#4m\3439\361`\027\324\364\222)] 
+ 
+ /Info 13 0 R
+ /Root 12 0 R
+ /Size 25 >>
+startxref
+6619
+%%EOF
Index: pkpgcounter/trunk/tests/runcolors.py
===================================================================
--- pkpgcounter/trunk/tests/runcolors.py (revision 380)
+++ pkpgcounter/trunk/tests/runcolors.py (revision 380)
@@ -0,0 +1,98 @@
+#! /usr/bin/env python
+# -*- coding: ISO-8859-15 -*-
+#
+# pkpgcounter : a generic Page Description Language parser
+#
+# (c) 2003, 2004, 2005, 2006 Jerome Alet <alet@librelogiciel.com>
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# $Id$
+#
+#
+
+"""This document was created with the help of the ReportLab ToolKit (tm)
+available as Free Software from http://www.reportlab.org
+
+It contains 9 pages, including this one.
+
+Each page after this one is entirely filled with 100% of a particular
+color, as described below :
+
+Page 1 ====> This notice
+Page 2 ====> Red
+Page 3 ====> Green
+Page 4 ====> Blue
+Page 5 ====> Cyan
+Page 6 ====> Magenta
+Page 7 ====> Yellow
+Page 8 ====> Black
+Page 9 ====> White
+
+This document helps to ensure that the computation of ink coverage
+made by pkpgcounter works as expected.
+
+To check by yourself :
+
+  $ for cspace in BW RGB CMY CMYK ; do
+        echo "Colorspace : $cspace" ;
+        pkpgcounter --colorspace $cspace colors.pdf ;
+        echo ;
+    done    
+
+Please report any problem to : alet@librelogiciel.com
+"""
+
+import sys
+try :
+    from reportlab.lib import colors
+    from reportlab.lib import pagesizes
+    from reportlab.lib.units import cm
+    from reportlab.pdfgen import canvas
+except ImportError :    
+    sys.stderr.write("Please download and install ReportLab\n\tfrom http://www.reportlab.org\n")
+    sys.exit(-1)
+
+if __name__ == "__main__" :
+    canv = canvas.Canvas("colors.pdf", pagesize=pagesizes.A4)
+    (width, height) = pagesizes.A4
+    xbase = 2*cm
+    ybase = height - 2*cm
+    
+    # First we output the explanations on the first page.
+    canv.setFont("Helvetica", 16)
+    for line in __doc__.split("\n") :
+        canv.drawString(xbase, ybase, line)
+        ybase -= 24
+    canv.showPage()
+    
+    # Then we output each page
+    for color in (colors.Color(1, 0, 0),        # Red
+                  colors.Color(0, 1, 0),        # Green
+                  colors.Color(0, 0, 1)) :      # Blue
+        canv.setStrokeColorRGB(*color.rgb())          
+        canv.setFillColorRGB(*color.rgb())          
+        canv.rect(0, 0, width, height, fill=1)
+        canv.showPage()
+        
+    for color in (colors.CMYKColor(1, 0, 0, 0), # Cyan
+                  colors.CMYKColor(0, 1, 0, 0), # Magenta
+                  colors.CMYKColor(0, 0, 1, 0), # Yellow
+                  colors.CMYKColor(0, 0, 0, 1), # Black
+                  colors.CMYKColor(0, 0, 0, 0)) : # White
+        canv.setStrokeColorCMYK(*color.cmyk())          
+        canv.setFillColorCMYK(*color.cmyk())          
+        canv.rect(0, 0, width, height, fill=1)
+        canv.showPage()
+    canv.save()        
