[Checkins] SVN: z3c.pdftemplate/trunk/src/z3c/ This package allows you to write PDF templates like you would write page

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Mar 8 10:44:21 EST 2007


Log message for revision 73066:
  This package allows you to write PDF templates like you would write page 
  templates. The package comes with both, PML and tinyRML, both released under 
  LGPL. Please read the LICENSES.txt file for more information.
  
  Roger Ineichen (Projekt01), Daniel Meier (Perse) and I have been using PDF 
  template for a long time and it is in production at several sites. All of us 
  have contributed to the code.
  
  

Changed:
  A   z3c.pdftemplate/trunk/src/z3c/
  A   z3c.pdftemplate/trunk/src/z3c/__init__.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/DEPENDENCIES.cfg
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/LICENSES.txt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/MAINTAINER.txt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/PUBLICATION.cfg
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/README.txt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/SETUP.cfg
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/ZopePublicLicense.txt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/__init__.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/configure.zcml
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/meta.zcml
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/metaconfigure.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/metadirectives.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/pdf.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Paragraph.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Parser.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Platypus.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/README.txt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/__init__.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/tests.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/rest.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/README.txt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/__init__.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rllicense.txt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rlpdf.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rltemplate.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/stylesheet.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/rml.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/bopplogo.gif
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/box.gif
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/dcolner.gif
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/devis.rml
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/devis_logo.jpg
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/dot_blue.gif
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/dot_red.gif
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex01.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex02.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex03.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex04.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex05.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex06.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex07.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex08.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex09.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex10.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex11.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex12.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex13.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex14.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/generic_template.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/logo.png
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/micromeshfoto.bmp
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/micromeshfoto.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/micromeshprot.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/pml_contents.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/pml_template.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/raylprot.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/replogo.gif
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rest.txt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rest_template.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rml_contents.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rollcard.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/screenshot.jpg
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/thicknessprot.pt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/tiny_logo.png
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample.zcml
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/tests.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/COPYRIGHT.txt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/INSTALL.txt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/LICENSE.txt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/README.txt
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/__init__.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/color.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trml2pdf.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trmlextchart.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trmlextfsimage.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/utils.py
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-configure.zcml
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-meta.zcml
  A   z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-sample-configure.zcml

-=-
Added: z3c.pdftemplate/trunk/src/z3c/__init__.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/__init__.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/__init__.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1 @@
+# Make a package


Property changes on: z3c.pdftemplate/trunk/src/z3c/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/DEPENDENCIES.cfg
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/DEPENDENCIES.cfg	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/DEPENDENCIES.cfg	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,9 @@
+docutils
+reportlab
+zope.annotation
+zope.app
+zope.configuration
+zope.interface
+zope.publisher
+zope.schema
+zope.testing

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/LICENSES.txt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/LICENSES.txt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/LICENSES.txt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,81 @@
+========
+LICENSES
+========
+
+The contents of this package is distributed under ZPL 2.1. See
+``ZopePublicLicense.txt``.
+
+
+pml2pdf
+-------
+
+The code in the ``pml2pdf`` package was developed by Ulrich Eck and is
+distributed under the GNU Lesser General Public License (LGPL). He included a
+modified file from reportlab, which is available under the following
+conditions:
+
+###############################################################################
+#
+# Copyright (c) 2000-2001, ReportLab Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+#   * Redistributions of source code must retain the above copyright notice,
+#     this list of conditions and the following disclaimer.
+#   * Redistributions in binary form must reproduce the above copyright notice,
+#     this list of conditions and the following disclaimer in the documentation
+#     and/or other materials provided with the distribution.
+#   * Neither the name of the company nor the names of its contributors may be
+#     used to endorse or promote products derived from this software without
+#     specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE OFFICERS OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+# DAMAGE.
+#
+###############################################################################
+
+
+rlpdf
+-----
+
+The code in ``rlpdf`` is partially put in the Public domain and includes code
+also subject to the above conditions. Thanks dreamcatcher!
+
+
+trml2pdf
+--------
+
+The code of Tiny RML2PDF package is distributed under the GNU Lesser General
+Public License (LGPL)..
+
+###############################################################################
+#
+# trml2pdf - An RML to PDF converter
+# Copyright (C) 2003, Fabien Pinckaers, UCL, FSA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+###############################################################################


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/LICENSES.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/MAINTAINER.txt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/MAINTAINER.txt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/MAINTAINER.txt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,3 @@
+Stephan Richter <stephan.richter at tufts.edu>
+Daniel Meier <daniel.meier at perse.ch>
+Roger Ineichen <roger at projekt01.ch>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/MAINTAINER.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/PUBLICATION.cfg
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/PUBLICATION.cfg	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/PUBLICATION.cfg	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,9 @@
+Metadata-Version: 1.0
+Name: pdftemplate
+Summary: reportlab-based PDF Browser Views 
+Author: Stephan Richter
+Author-email: stephan.richter at gmail.com
+License: ZPL 2.1
+Description:
+        This package provides directives for Zope 3 that allow the
+        registration of browser views that generate PDF files.

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/README.txt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/README.txt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/README.txt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,446 @@
+=====================================
+Using ReportLab to generate PDF Views
+=====================================
+
+This package,
+
+  >>> import z3c.pdftemplate
+
+provides the functionality of creating browser views that generate PDFs
+instead of HTML using reportlab's PDF writer technology. There are several
+ways to use the features in this package, which are demonstrated in the text
+below.
+
+But first we have to load the directives' meta configuration:
+
+  >>> from zope.app import zapi
+  >>> from zope.publisher.browser import TestRequest
+  >>> from zope.configuration import xmlconfig
+  >>> context = xmlconfig.file('meta.zcml', package=z3c.pdftemplate)
+
+
+PML to PDF Views
+----------------
+
+PML, an XML-dialect developed by Ulrich Eck, is much like HTML in that it lets
+you define the structure of a PDF document. The PML is dynamically generated
+using page templates and then used to generate a PDF file.
+
+Let's say we want to create a PDF that shows the contents of a folder. The
+first step is to create a document template that contains the structure of the
+PDF. The following folder contents document template is available in
+``folder_contents.pt``::
+
+  <?xml version="1.0" encoding="iso-8859-15"?>
+  <document
+      xmlns:tal="http://xml.zope.org/namespaces/tal"
+      xmlns:metal="http://xml.zope.org/namespaces/metal"
+      filename="contents.pdf">
+  <content>
+
+  <para style="FolderName">
+    Folder Name:
+    <tal:block
+       condition="context/zope:name"
+       replace="context/zope:name|default" />
+    <tal:block condition="not:context/zope:name">&lt;no name&gt;</tal:block>
+  </para>
+
+  <spacer height="30" />
+
+  <table splitbyrow="1" repeatrows="0" repeatcols="0" style="ContentTable">
+    <tr>
+      <td>Name</td>
+      <td>Title</td>
+      <td>Size</td>
+      <td>Created</td>
+      <td>Modified</td>
+    </tr>
+    <tr tal:repeat="item view/listContentInfo">
+      <td tal:content="item/id">me.png</td>
+      <td tal:content="item/title|default">&lt;no title&gt;</td>
+      <td tal:content="item/size/sizeForDisplay|nothing">34.5 kB</td>
+      <td tal:content="item/created|default"></td>
+      <td tal:content="item/modified|default"></td>
+    </tr>
+  </table>
+
+  <action name="frameEnd" />
+
+  </content>
+  </document>
+
+Pretty easy isn't it? Fortunately, we can simply reuse the ``Contents`` view
+class for the HTML contents view. Now that we have defined the document, we
+have to create a PDF template, so that the table will look nice. The following
+template code can be found in ``folder_template.pt``::
+
+  <?xml version="1.0" encoding="utf-8"?>
+  <template
+      filename="contents.pdf"
+      pagesize="A4"
+      landscape="0"
+      showboundary="0"
+      leftmargin="1cm"
+      rightmargin="1cm"
+      topmargin="1cm"
+      bottommargin="1cm"
+      allowsplitting="1">
+
+    <stylesheet>
+
+     <paragraphstyle
+         name="Base"
+         fontName="Helvetica"
+         fontSize="10"
+         align="LEFT"
+         firstLineIndent="0cm"
+         leftIndent="0.5cm"
+         rightIndent="0cm"
+         spaceBefore="0"
+         spaceAfter="0"
+         leading="0.5cm"
+         bulletFontName="Helvetica"
+         bulletIndent="0cm"
+         bulletFontSize="10" />
+
+     <paragraphstyle
+         name="FolderName"
+         parent="Base"
+         leftIndent="0cm"
+         fontName="Helvetica-Bold"
+         fontSize="16"
+         leading="0.5cm"
+         spaceBefore="4"
+         spaceAfter="4" />
+
+     <tablestyle name="ContentTable">
+       <stylecmd expr="('LEFTPADDING', (0,0), (-1,-1), 5)"/>
+       <stylecmd expr="('RIGHTPADDING', (0,0), (-1,-1), 5)"/>
+       <stylecmd expr="('TOPPADDING', (0,0), (-1,-1), 3)"/>
+       <stylecmd expr="('BOTTOMPADDING', (0,0), (-1,-1), 7)"/>
+       <stylecmd expr="('ALIGN', (0,0), (-1,-1), 'LEFT')"/>
+       <stylecmd expr="('GRID', (0,0), (-1,-1), 0.5, colors.black)"/>
+       <stylecmd expr="('BOX', (0,0), (-1,-1), 1, colors.black)"/>
+       <stylecmd expr="('FONT', (1,1), (-1,-1), 'Helvetica', 10)"/>
+       <stylecmd expr="('FONT', (0,0), (-1,0), 'Helvetica-Bold', 10)"/>
+       <stylecmd expr="('FONT', (0,1), (0,-1), 'Courier', 10)"/>
+     </tablestyle>
+
+    </stylesheet>
+
+
+    <pagetemplate id="Page" >
+      <static>
+        <infostring
+            align="left"
+            x="5cm"
+            y="28cm"
+            size="10"
+  	  font="Helvetica"
+            color="(0, 0, 0)">
+          The development of the PDF Template Code was sposored by Projekt01.
+        </infostring>
+      </static>
+
+      <frame
+          id="content"
+     	nextid="content"
+      	x="2cm"
+          y="1.5cm"
+  	width="17cm"
+  	height="25.5cm"
+  	leftpadding="0.1cm"
+  	rightpadding="0.1cm"
+  	toppadding="0.5cm"
+  	bottompadding="0.5cm"
+  	showBoundary="0" />
+    </pagetemplate>
+
+  </template>
+
+Now that we have the template and the document, we can simply register the
+view:
+
+  >>> context = xmlconfig.string("""
+  ...     <configure xmlns:browser="http://namespaces.zope.org/browser">
+  ...       <browser:pml2pdf
+  ...           name="sample_pml.pdf"
+  ...           for="zope.app.folder.interfaces.IFolder"
+  ...           template="sample/pml_template.pt"
+  ...           document="sample/pml_contents.pt"
+  ...           class="zope.app.container.browser.contents.Contents"
+  ...           permission="zope.Public"
+  ...           />
+  ...     </configure>
+  ...     """, context)
+
+Once we have created a folder instance:
+
+  >>> from zope.app.folder.folder import Folder
+  >>> folder = Folder()
+  >>> folder.__name__ = 'my folder'
+  >>> folder['subFolder'] = Folder()
+
+we can can look up the view
+
+  >>> class Principal:
+  ...   id = 'bob'
+
+  >>> request = TestRequest()
+  >>> request.setPrincipal(Principal())
+
+  >>> contents = zapi.getMultiAdapter((folder, request),
+  ...                                 name="sample_pml.pdf")
+
+and create the PDF:
+
+  #>>> contents() #doctest: +ELLIPSIS
+  #'%PDF-1.3...'
+
+Again, you cannot just register any template for the document. The styles that
+are used in the document *must* be declared in the PDF template. In the
+following case we are not specifying any template, so that the generic
+template is used, which does not have the right styles defined:
+
+  >>> context = xmlconfig.string("""
+  ...     <configure xmlns:browser="http://namespaces.zope.org/browser">
+  ...       <browser:pml2pdf
+  ...           name="contents2.pdf"
+  ...           for="zope.app.folder.interfaces.IFolder"
+  ...           document="sample/pml_contents.pt"
+  ...           class="zope.app.container.browser.contents.Contents"
+  ...           permission="zope.Public"
+  ...           />
+  ...     </configure>
+  ...     """, context)
+
+  >>> contents = zapi.getMultiAdapter((folder, request),
+  ...                                 name="contents2.pdf")
+  >>> contents()
+  Traceback (most recent call last):
+  ...
+      stylesheet[self.style],
+  KeyError: 'FolderName'
+
+
+Generic PDF Views
+-----------------
+
+Sometimes, however, you do not want to use PML to structure your content, but
+use the reportlab API directly. But you still want to use the template
+mechanism. For these cases there is a very simple directive that requires you
+to implement a view class yourself. Let's use the simplest case possible and
+create a PDF that returns an empty page.
+
+The first step is to create the view class:
+
+  >>> from StringIO import StringIO
+  >>> class NullPage(object):
+  ...
+  ...     def __call__(self):
+  ...         buffer = StringIO()
+  ...         template = self.getPDFTemplate()
+  ...         template.build([], buffer)
+  ...
+  ...         self.request.response.setHeader('content-type', 'application/pdf')
+  ...         return buffer.getvalue()
+
+We have to add the class to a loadable module:
+
+  >>> z3c.pdftemplate.tests.NullPage = NullPage
+
+Next we register the view:
+
+  >>> context = xmlconfig.string("""
+  ...     <configure xmlns:browser="http://namespaces.zope.org/browser">
+  ...       <browser:pdf
+  ...           name="null.pdf"
+  ...           for="*"
+  ...           class="z3c.pdftemplate.tests.NullPage"
+  ...           permission="zope.Public"
+  ...           />
+  ...     </configure>
+  ...     """, context)
+
+  >>> contents = zapi.getMultiAdapter((None, request), name="null.pdf")
+  >>> print contents() #doctest: +ELLIPSIS
+  %PDF-1.3...
+
+Doing some cleanup:
+
+  >>> del z3c.pdftemplate.tests.NullPage
+
+
+=====================================================
+Using TinyRML2PDF and ReportLab to generate PDF Views
+=====================================================
+
+See ../INSTALL.txt and DEPENDENCIES.cfg, this lib depends on some 3rd party
+libraries.
+
+
+Purpose: PDF-Generration with the help of TinyRML (an open source implementation
+of RML) and Reportlab.
+
+We did some customizing in the RML-Language, so its possible to produce Chart
+directly.
+
+
+This package provides the functionality of creating browser views that
+generate PDFs instead of HTML using reportlab's PDF writer technology.
+
+But first we have to load the directives' meta configuration:
+
+  >>> from zope.configuration import xmlconfig
+  >>> context = xmlconfig.file('meta.zcml', package=z3c.pdftemplate)
+
+
+RML, an XML-dialect developed by Reportlab.org, is much like HTML in that it
+lets you define the structure of a PDF document. The RML is dynamically
+generated using page templates and then used to generate a PDF file.
+
+
+Let's say we want to create a PDF that shows the contents of a folder. The
+first step is to create a rml-document that contains the structure of the
+PDF. The following folder contents document template is available in
+``rml_contents.pt``
+
+::
+
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
+<!DOCTYPE document SYSTEM "rml_1_0.dtd">
+<document
+    xmlns:tal="http://xml.zope.org/namespaces/tal"
+    xmlns:metal="http://xml.zope.org/namespaces/metal"
+    filename="contents.pdf">
+<content>
+
+<para style="FolderName">
+  Folder Name:
+  <tal:block
+     condition="context/__name__"
+     replace="context/__name__|default" />
+  <tal:block condition="not:context/__name__">&lt;no name&gt;</tal:block>
+</para>
+
+<spacer height="30" />
+
+<table splitbyrow="1" repeatrows="0" repeatcols="0" style="ContentTable">
+  <tr>
+    <td>Name</td>
+    <td>Title</td>
+    <td>Size</td>
+    <td>Created</td>
+    <td>Modified</td>
+  </tr>
+  <tr tal:repeat="item view/listContentInfo">
+    <td tal:content="item/id">me.png</td>
+    <td tal:content="item/title|default">&lt;no title&gt;</td>
+    <td tal:content="item/size/sizeForDisplay|nothing">34.5 kB</td>
+    <td tal:content="item/created|default"></td>
+    <td tal:content="item/modified|default"></td>
+  </tr>
+</table>
+
+<action name="frameEnd" />
+
+</content>
+</document>
+
+Pretty easy isn't it? Fortunately, we can simply reuse the ``Contents`` view
+class for the HTML contents view.
+
+Now that we have the template and the document, we can simply register the
+view:
+
+  >>> context = xmlconfig.string("""
+  ...     <configure xmlns:browser="http://namespaces.zope.org/browser">
+  ...       <browser:rml2pdf
+  ...           name="rmlsample.pdf"
+  ...           for="zope.app.folder.interfaces.IFolder"
+  ...           document="sample/rml_contents.pt"
+  ...           class="zope.app.container.browser.contents.Contents"
+  ...           permission="zope.Public"
+  ...           />
+  ...     </configure>
+  ...     """, context)
+
+Once we have created a folder instance:
+
+  >>> from zope.app.folder.folder import Folder
+  >>> folder = Folder()
+  >>> folder.__name__ = 'my folder'
+  >>> folder['subFolder'] = Folder()
+
+we can can look up the view
+
+  >>> class Principal:
+  ...   id = 'bob'
+
+  >>> request = TestRequest()
+  >>> request.setPrincipal(Principal())
+
+  >>> contents = zapi.getMultiAdapter((folder, request),
+  ...                                 name="rmlsample.pdf")
+
+and create the PDF:
+
+  >>> contents() #doctest: +ELLIPSIS
+  '%PDF-1.3...'
+
+
+ReST to PDF Resources
+---------------------
+
+Using the ``browser:rest2pdf`` directive, you simply specify an ReST file, and
+the resource is available. For example, let's make a PDF out of this file:
+
+  >>> context = xmlconfig.string("""
+  ...     <configure xmlns:browser="http://namespaces.zope.org/browser">
+  ...       <browser:rest2pdf
+  ...           name="pdftemplate.pdf"
+  ...           path="sample/rest.txt"
+  ...           />
+  ...     </configure>
+  ...     """, context)
+
+  >>> resource = zapi.getAdapter(TestRequest(), name="pdftemplate.pdf")
+  >>> resource()
+  '%PDF-1.3...'
+
+Optionally, you can specify your custom PDF template as well:
+
+  >>> context = xmlconfig.string("""
+  ...     <configure xmlns:browser="http://namespaces.zope.org/browser">
+  ...       <browser:rest2pdf
+  ...           name="pdftemplate2.pdf"
+  ...           path="sample/rest.txt"
+  ...           template="sample/rest_template.pt"
+  ...           />
+  ...     </configure>
+  ...     """, context)
+
+  >>> resource = zapi.getAdapter(TestRequest(), name="pdftemplate2.pdf")
+  >>> resource() #doctest: +ELLIPSIS
+  '%PDF-1.3...'
+
+But be careful, the template needs to contain specially named styles, so that
+not any arbitrary template will work:
+
+  >>> context = xmlconfig.string("""
+  ...     <configure xmlns:browser="http://namespaces.zope.org/browser">
+  ...       <browser:rest2pdf
+  ...           name="pdftemplate3.pdf"
+  ...           path="sample/rest.txt"
+  ...           template="sample/generic_template.pt"
+  ...           />
+  ...     </configure>
+  ...     """, context)
+
+  >>> resource = zapi.getAdapter(TestRequest(), name="pdftemplate3.pdf")
+  >>> resource()
+  Traceback (most recent call last):
+  ...
+      style = self.styleSheet[in_style]
+  KeyError: 'h1'


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/SETUP.cfg
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/SETUP.cfg	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/SETUP.cfg	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,5 @@
+# Tell zpkg how to install the ZCML slugs.
+
+<data-files zopeskel/etc/package-includes>
+  z3c.pdftemplate-*.zcml
+</data-files>

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/ZopePublicLicense.txt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/ZopePublicLicense.txt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/ZopePublicLicense.txt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,54 @@
+Zope Public License (ZPL) Version 2.1
+-------------------------------------
+
+A copyright notice accompanies this license document that
+identifies the copyright holders.
+
+This license has been certified as open source. It has also
+been designated as GPL compatible by the Free Software
+Foundation (FSF).
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions in source code must retain the
+   accompanying copyright notice, this list of conditions,
+   and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the accompanying
+   copyright notice, this list of conditions, and the
+   following disclaimer in the documentation and/or other
+   materials provided with the distribution.
+
+3. Names of the copyright holders must not be used to
+   endorse or promote products derived from this software
+   without prior written permission from the copyright
+   holders.
+
+4. The right to distribute this software or to use it for
+   any purpose does not give you the right to use
+   Servicemarks (sm) or Trademarks (tm) of the copyright
+   holders. Use of them is covered by separate agreement
+   with the copyright holders.
+
+5. If any files are modified, you must cause the modified
+   files to carry prominent notices stating that you changed
+   the files and the date of any change.
+
+Disclaimer
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
+  AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+  NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
+  NO EVENT SHALL THE COPYRIGHT HOLDERS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+  DAMAGE.


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/ZopePublicLicense.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/__init__.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/__init__.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/__init__.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+###############################################################################
+"""PDF Template Package
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from reportlab.pdfbase import pdfmetrics
+
+# Register some initial fonts.
+pdfmetrics.registerFont(pdfmetrics.Font('Helvetica-WinAnsi',
+                                        'Helvetica',
+                                        'WinAnsiEncoding'))
+pdfmetrics.registerFont(pdfmetrics.Font('Helvetica-Bold-WinAnsi',
+                                        'Helvetica-Bold',
+                                        'WinAnsiEncoding'))
+pdfmetrics.registerFont(pdfmetrics.Font('Helvetica-BoldOblique-WinAnsi',
+                                        'Helvetica-BoldOblique',
+                                        'WinAnsiEncoding'))


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/configure.zcml
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/configure.zcml	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/configure.zcml	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,19 @@
+<configure
+    xmlns:apidoc="http://namespaces.zope.org/apidoc"
+    xmlns:zcml="http://namespaces.zope.org/zcml"
+    i18n_domain="zope">
+
+  <!-- Register application with API Doc Tool -->
+  <configure zcml:condition="have apidoc">
+
+    <apidoc:rootModule module="z3c.pdftemplate"  />
+
+  <apidoc:bookchapter 
+      id="pdf"
+      title="PDF Resources and Views"
+      doc_path="README.txt"
+      />
+
+  </configure>
+
+</configure>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/meta.zcml
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/meta.zcml	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/meta.zcml	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,34 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:meta="http://namespaces.zope.org/meta"
+    >
+
+  <meta:directives namespace="http://namespaces.zope.org/browser">
+
+    <meta:directive
+        name="pdf"
+        schema=".metadirectives.IPDFDirective"
+        handler=".metaconfigure.pdf"
+        />
+        
+    <meta:directive
+        name="pml2pdf"
+        schema=".metadirectives.IPMLToPDFDirective"
+        handler=".metaconfigure.pml2pdf"
+        />
+
+    <meta:directive
+        name="rest2pdf"
+        schema=".metadirectives.IReSTToPDFDirective"
+        handler=".metaconfigure.rest2pdf"
+        />
+        
+    <meta:directive
+        name="rml2pdf"
+        schema=".metadirectives.IRMLToPDFDirective"
+        handler=".metaconfigure.rml2pdf"
+        />
+
+  </meta:directives>
+
+</configure>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/meta.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/metaconfigure.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/metaconfigure.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/metaconfigure.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,131 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+###############################################################################
+"""Directive Handler for several PDF generating presentation components
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import os.path
+
+from zope.configuration.exceptions import ConfigurationError
+from zope.publisher.interfaces.browser import IDefaultBrowserLayer
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.app.publisher.browser.resourcemeta import resource
+from zope.app.publisher.browser.viewmeta import page
+
+import z3c.pdftemplate
+from z3c.pdftemplate.pdf import PDFView
+from z3c.pdftemplate.pml import PML2PDFView
+from z3c.pdftemplate.rest import ReSTPDFResourceFactory
+from z3c.pdftemplate.rml import RML2PDFView
+
+
+def getTemplatePath(_context, template, default='sample/generic_template.pt'):
+    """Return the path of the PDF template."""
+    if template is None:
+        template = os.path.join(
+            os.path.dirname(z3c.pdftemplate.__file__), default)
+
+    template = os.path.abspath(str(_context.path(template)))
+    if not os.path.isfile(template):
+        raise ConfigurationError("No such file", template)
+    return template
+
+
+def pdf(_context, name, permission, for_, class_,
+        template=None, layer=IDefaultBrowserLayer,
+        allowed_interface=None, allowed_attributes=None,
+        menu=None, title=None):
+
+    template = getTemplatePath(_context, template)
+
+    if PDFView not in class_.__bases__:
+        bases = (class_, PDFView)
+    else:
+        bases = (class_,)
+
+    factory = type(
+        'PDFView using template=%s' %template,
+        bases, {'template': ViewPageTemplateFile(template)} )
+
+    page(_context, name, permission, for_, layer, None, factory,
+         allowed_interface, allowed_attributes, '__call__', menu, title)
+
+
+def pml2pdf(_context, name, permission, for_, document,
+            template=None, layer=IDefaultBrowserLayer, class_=PML2PDFView,
+            allowed_interface=None, allowed_attributes=None,
+            menu=None, title=None):
+
+    template = getTemplatePath(_context, template)
+
+    document = os.path.abspath(str(_context.path(document)))
+    if not os.path.isfile(document):
+        raise ConfigurationError("No such file", document)
+
+    if class_ is not PML2PDFView and PML2PDFView not in class_.__bases__:
+        bases = (class_, PML2PDFView)
+    else:
+        bases = (class_,)
+
+    factory = type(
+        'PML2PDFView from template=%s, document=%s' %(template, document),
+        bases,
+        {'template': ViewPageTemplateFile(template),
+         'document': ViewPageTemplateFile(document)}
+        )
+
+    page(_context, name, permission, for_, layer, None, factory,
+         allowed_interface, allowed_attributes, '__call__', menu, title)
+
+
+def rest2pdf(_context, name, path,
+             template=None,
+             layer=IDefaultBrowserLayer, permission='zope.Public'):
+
+    template = getTemplatePath(_context, template, 'sample/rest_template.pt')
+
+    path = os.path.abspath(str(_context.path(path)))
+    if not os.path.isfile(path):
+        raise ConfigurationError("No such file", path)
+
+    factory = ReSTPDFResourceFactory(path, ViewPageTemplateFile(template))
+
+    resource(_context, name, layer, permission, factory)
+
+    
+def rml2pdf(_context, name, permission, for_, document,
+            layer=IDefaultBrowserLayer, class_=RML2PDFView,
+            allowed_interface=None, allowed_attributes=None,
+            menu=None, title=None):
+
+    document = os.path.abspath(str(_context.path(document)))
+    if not os.path.isfile(document):
+        raise ConfigurationError("No such file", document)
+
+    if class_ is not RML2PDFView and RML2PDFView not in class_.__bases__:
+        bases = (class_, RML2PDFView)
+    else:
+        bases = (class_,)
+
+    factory = type(
+        'RML2PDFView from document=%s' %(document),
+        bases,
+        {'document': ViewPageTemplateFile(document)}
+        )
+
+    page(_context, name, permission, for_, layer, None, factory,
+         allowed_interface, allowed_attributes, '__call__', menu, title)    


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/metaconfigure.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/metadirectives.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/metadirectives.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/metadirectives.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,111 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+###############################################################################
+"""``pdf`` directive for generating PDFs from PML
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.interface import Interface
+from zope.schema import TextLine
+from zope.configuration.fields import Path
+from zope.app.publisher.browser.metadirectives import IViewDirective
+from zope.app.publisher.browser.metadirectives import IBasicResourceInformation
+
+
+class IPDFBaseDirective(Interface):
+    """Base directive for PDF-generating browser views.
+
+    All PDF-generating components of this package require some information on
+    how to layout the PDF page, such as the page layout and style sheet. All
+    of this information is contained in a PML-based template.
+    """
+    template = Path(
+        title=u"PML Template Page Template",
+        description=u"""
+        Refers to a file containing a page template that will generate the
+        PML template/style file for PDF generation.""",
+        required=False
+        )
+
+class IPDFDirective(IPDFBaseDirective, IViewDirective):
+    """A simple view directive that generates PDFs.
+
+    Most of the work is up to the view class you are providing, since you have
+    to specify how the PDF is generated. The only help you are getting is that
+    the PDF layout template is generated for you.
+    """
+
+class IPMLToPDFDirective(IPDFDirective):
+    """A view directive that dynamically evaluates a PML document and converts
+    it to PDF.
+
+    This directive behaves very much like the ``page`` directive, except that
+    it does not generate HTML, but PML that is rendered to PDF for output. PML
+    is a simple XML-dialect that creates a storyboard for the reportlab PDF
+    rendering engine.
+    """
+
+    document = Path(
+        title=u"PML Document Page Template",
+        description=u"""
+        Refers to a file containing a page template that will generate the
+        PML data file for PDF generation.""",
+        required=True
+        )
+
+class IReSTToPDFDirective(IPDFBaseDirective, IBasicResourceInformation):
+    """A resource directive that converts ReST documents to PDF.
+
+    All you basically need to do is specify a the path to the ReST file. If
+    you do not provide your own template file, a sensible default PDF template
+    is provided.
+    """
+
+    name = TextLine(
+        title=u"The name of the resource",
+        description=u"""
+        This is the name used in resource urls. Resource urls are of
+        the form site/@@/resourcename, where site is the url of
+        "site", a folder with a site manager.
+
+        We make resource urls site-relative (as opposed to
+        content-relative) so as not to defeat caches.""",
+        required=True
+        )
+
+    path = Path(
+        title=u"Path of the ReST File",
+        description=u"""Refers to the path of the ReST file.""",
+        required=True
+        )
+
+class IRMLToPDFDirective(Interface, IViewDirective):
+    """A view directive that dynamically evaluates a RML document and converts
+    it to PDF.
+
+    This directive behaves very much like the ``page`` directive, except that
+    it does not generate HTML, but RML that is rendered to PDF for output. RML
+    is a simple XML-dialect that creates a storyboard for the reportlab PDF
+    rendering engine.
+    """
+
+    document = Path(
+        title=u"RML Document Page Template",
+        description=u"""
+        Refers to a file containing a page template that will generate the
+        RML data file for PDF generation.""",
+        required=True
+        )  
\ No newline at end of file


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/metadirectives.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pdf.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/pdf.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/pdf.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+###############################################################################
+"""PDF generation base classes
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import xml.dom.minidom
+from StringIO import StringIO
+from zope.publisher.browser import BrowserView
+from z3c.pdftemplate.pml2pdf.Parser import TemplateParser
+
+class ResourceHandler:
+    """Wrapper to allow loading from external resources.
+
+    The implementation forbids local file access for security reasons.
+    """
+
+    def get(self, url, data=None):
+        url = str(url)
+        if url.startswith('file:'):
+            raise urllib2.URLError, \
+                  'The file: protocol is disabled for security'
+        fd = self.opener.open(url, data)
+        return StringIO(fd.read())
+
+
+class PDFTemplateGenerator(object):
+
+    template = None
+
+    def getPDFTemplate(self):
+        # create the PDFTemplate from xml
+        template_xml = self.template(self).encode('utf-8')
+        template_dom = xml.dom.minidom.parseString(template_xml)
+        template = TemplateParser(template_dom, 'utf-8', ResourceHandler())()
+        # Boilerplate from PML :(
+        template.title = ''
+        template.author = ''
+        template.subject = ''
+        return template
+
+
+class PDFView(PDFTemplateGenerator, BrowserView):
+    """Base-class for objects rendering PDFs using a template."""
+    pass


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pdf.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+###############################################################################
+"""PML-to-PDF View
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import xml.dom.minidom
+from StringIO import StringIO
+
+from zope.publisher.browser import BrowserPage
+
+from z3c.pdftemplate.pml2pdf.Parser import TemplateParser, DocumentParser
+from z3c.pdftemplate.pdf import PDFTemplateGenerator, ResourceHandler
+
+class PML2PDFView(PDFTemplateGenerator, BrowserPage):
+
+    document = None
+
+    def __call__(self):
+        # create the PDFDocment from xml
+        document_xml = self.document(self).encode('utf-8')
+        document_dom = xml.dom.minidom.parseString(document_xml)
+        document = DocumentParser(document_dom, 'utf-8', ResourceHandler())
+
+        # create the PDF itself using the document and the template
+        buffer = StringIO()
+        document(self.getPDFTemplate(), buffer)
+        buffer.seek(0)
+
+        # Set the content type to application/pdf
+        self.request.response.setHeader('content-type', 'application/pdf')
+
+        return buffer.read()


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Paragraph.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Paragraph.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Paragraph.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,2375 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   CMFReportTool - Generating PDF-Skins on the Fly from CMF-Sites
+#
+#   Copyright (C) 2002  net-labs Systemhaus GmbH
+#                                               info at net-labs.de
+#
+#   This library is free software; you can redistribute it and/or
+#   modify it under the terms of the GNU Lesser General Public
+#   License as published by the Free Software Foundation; either
+#   version 2.1 of the License, or (at your option) any later version.
+#
+#   This library 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
+#   Lesser General Public License for more details.
+#
+#   You should have received a copy of the GNU Lesser General Public
+#   License along with this library; if not, write to the Free Software
+#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+###############################################################################
+"""new experimental paragraph implementation
+
+Intended to allow support for paragraphs in paragraphs, hotlinks,
+embedded flowables, and underlining.  The main entry point is the
+function
+
+def Paragraph(text, style, bulletText=None, frags=None)
+
+Which is intended to be plug compatible with the "usual" platypus
+paragraph except that it supports more functionality.
+
+In this implementation you may embed paragraphs inside paragraphs
+to create hierarchically organized documents.
+
+This implementation adds the following paragraph-like tags (which
+support the same attributes as paragraphs, for font specification, etc).
+
+- Unnumberred lists (ala html):
+
+    <ul>
+        <li>first one</li>
+        <li>second one</li>
+    </ul>
+
+Also <ul type="disc"> (default) or <ul type="circle">, <ul type="square">.
+
+- Numberred lists (ala html):
+
+    <ol>
+        <li>first one</li>
+        <li>second one</li>
+    </ol>
+
+Also <ul type="1"> (default) or <ul type="a">, <ul type="A">.
+
+- Display lists (ala HTML):
+
+For example
+
+<dl bulletFontName="Helvetica-BoldOblique" spaceBefore="10" spaceAfter="10">
+<dt>frogs</dt> <dd>Little green slimy things. Delicious with <b>garlic</b></dd>
+<dt>kittens</dt> <dd>cute, furry, not edible</dd>
+<dt>bunnies</dt> <dd>cute, furry,. Delicious with <b>garlic</b></dd>
+</dl>
+
+ALSO the following additional internal paragraph markup tags are supported
+
+<u>underlined text</u>
+
+<a href="http://www.reportlab.com">hyperlinked text</a>
+<a href="http://www.reportlab.com" color="blue">hyperlinked text</a>
+
+<link destination="end" >Go to the end (go to document internal destination)</link>
+<link destination="start" color="cyan">Go to the beginning</link>
+
+<setLink destination="start" color="magenta">This is the document start
+  (define document destination inside paragraph, color is optional)</setLink>
+
+"""
+
+# copied from reportlab.platypus v 1.18
+# because of several bugs/incompatiblities
+
+
+from reportlab.pdfbase.pdfmetrics import stringWidth
+from reportlab.lib.utils import fp_str
+from reportlab.platypus.flowables import Flowable
+from reportlab.lib import colors
+
+from types import StringType, UnicodeType, InstanceType, TupleType, ListType, FloatType
+
+# SET THIS TO CAUSE A VIEWING BUG WITH ACROREAD 3 (for at least one input)
+# CAUSEERROR = 0
+
+debug = 0
+
+DUMPPROGRAM = 0
+
+TOOSMALLSPACE = 1e-5
+
+from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
+
+# indent changes effect the next line
+# align changes effect the current line
+
+# need to fix spacing questions... if ends with space then space may be inserted
+
+# NEGATIVE SPACE SHOULD NEVER BE EXPANDED (IN JUSTIFICATION, EG)
+
+class paragraphEngine:
+    # text origin of 0,0 is upper left corner
+    def __init__(self, program = None):
+        from reportlab.lib.colors import black
+        if program is None:
+            program = []
+        self.lineOpHandlers = [] # for handling underlining and hyperlinking, etc
+        self.program = program
+        self.indent = self.rightIndent = 0.0
+        self.baseindent = 0.0 # adjust this to add more indentation for bullets, eg
+        self.fontName = "Helvetica"
+        self.fontSize = 10
+        self.leading = 12
+        self.fontColor = black
+        self.x = self.y = self.rise = 0.0
+        from reportlab.lib.enums import TA_LEFT
+        self.alignment = TA_LEFT
+        self.textStateStack = []
+
+    TEXT_STATE_VARIABLES = ("indent", "rightIndent", "fontName", "fontSize",
+                            "leading", "fontColor", "lineOpHandlers", "rise",
+                            "alignment")
+                            #"textStateStack")
+
+    def pushTextState(self):
+        state = []
+        for var in self.TEXT_STATE_VARIABLES:
+            val = getattr(self, var)
+            state.append(val)
+        #self.textStateStack.append(state)
+        self.textStateStack = self.textStateStack+[state] # fresh copy
+        #print "push", self.textStateStack
+        #print "push", len(self.textStateStack), state
+        return state
+
+    def popTextState(self):
+        state = self.textStateStack[-1]
+        self.textStateStack = self.textStateStack[:-1]
+        #print "pop", self.textStateStack
+        state = state[:] # copy for destruction
+        #print "pop", len(self.textStateStack), state
+        #print "handlers before", self.lineOpHandlers
+        for var in self.TEXT_STATE_VARIABLES:
+            val = state[0]
+            del state[0]
+            setattr(self, var, val)
+
+    def format(self, maxwidth, maxheight, program, leading=0):
+        "return program with line operations added if at least one line fits"
+        # note: a generated formatted segment should not be formatted again
+        startstate = self.__dict__.copy()
+        #remainder = self.cleanProgram(program)
+        remainder = program[:]
+        #program1 = remainder[:] # debug only
+        lineprogram = []
+        #if maxheight<TOOSMALLSPACE:
+        #    raise ValueError, "attempt to format inside too small a height! "+repr(maxheight)
+        heightremaining = maxheight
+        if leading: self.leading = leading
+        room = 1
+        cursorcount = 0 # debug
+        while remainder and room: #heightremaining>=self.leading and remainder:
+            #print "getting line with statestack", len(self.textStateStack)
+            #heightremaining = heightremaining - self.leading
+            indent = self.indent
+            rightIndent = self.rightIndent
+            linewidth = maxwidth - indent - rightIndent
+            beforelinestate = self.__dict__.copy()
+            if linewidth<TOOSMALLSPACE:
+                raise ValueError, "indents %s %s too wide for space %s" % (self.indent, self.rightIndent, \
+                                                                           maxwidth)
+            try:
+                (lineIsFull, line, cursor, currentLength, \
+                 usedIndent, maxLength, justStrings) = self.fitLine(remainder, maxwidth)
+            except:
+##                print "failed to fit line near", cursorcount # debug
+##                for i in program1[max(0,cursorcount-10): cursorcount]:
+##                    print
+##                    print i,
+##                print "***" *8
+##                for i in program1[cursorcount:cursorcount+20]:
+##                    print i
+                raise
+            cursorcount = cursorcount+cursor # debug
+            leading = self.leading
+            if heightremaining>leading:
+                heightremaining = heightremaining-leading
+            else:
+                room = 0
+                #self.resetState(beforelinestate)
+                self.__dict__.update(beforelinestate)
+                break # no room for this line
+##            if debug:
+##                print "line", line
+##                if lineIsFull: print "is full"
+##                else: print "is partially full"
+##                print "consumes", cursor, "elements"
+##                print "covers", currentLength, "of", maxwidth
+            alignment = self.alignment # last declared alignment for this line used
+            # recompute linewidth using the used indent
+            #linewidth = maxwidth - usedIndent - rightIndent
+            remainder = remainder[cursor:]
+            if not remainder:
+                # trim off the extra end of line
+                del line[-1]
+            # do justification if any
+            #line = self.shrinkWrap(line
+            if alignment==TA_LEFT:
+                #if debug:
+                #    print "ALIGN LEFT"
+                if justStrings:
+                    line = stringLine(line, currentLength)
+                else:
+                    line = self.shrinkWrap(line)
+                pass
+            elif alignment==TA_CENTER:
+                #if debug:
+                #    print "ALIGN CENTER"
+                if justStrings:
+                    line = stringLine(line, currentLength)
+                else:
+                    line = self.shrinkWrap(line)
+                line = self.centerAlign(line, currentLength, maxLength)
+            elif alignment==TA_RIGHT:
+                #if debug:
+                #    print "ALIGN RIGHT"
+                if justStrings:
+                    line = stringLine(line, currentLength)
+                else:
+                    line = self.shrinkWrap(line)
+                line = self.rightAlign(line, currentLength, maxLength)
+            elif alignment==TA_JUSTIFY:
+                #if debug:
+                #    print "JUSTIFY"
+                if remainder and lineIsFull:
+                    if justStrings:
+                        line = simpleJustifyAlign(line, currentLength, maxLength)
+                    else:
+                        line = self.justifyAlign(line, currentLength, maxLength)
+                else:
+                    if justStrings:
+                        line = stringLine(line, currentLength)
+                    else:
+                        line = self.shrinkWrap(line)
+                    if debug:
+                        print "no justify because line is not full or end of para"
+            else:
+                raise ValueError, "bad alignment "+repr(alignment)
+            if not justStrings:
+                line = self.cleanProgram(line)
+            lineprogram.extend(line)
+        laststate = self.__dict__.copy()
+        #self.resetState(startstate)
+        self.__dict__.update(startstate)
+        heightused = maxheight - heightremaining
+        return (lineprogram, remainder, laststate, heightused)
+
+    def getState(self):
+        # inlined
+        return self.__dict__.copy()
+
+    def resetState(self, state):
+        # primarily inlined
+        self.__dict__.update(state)
+
+##    def sizeOfWord(self, word):
+##        inlineThisFunctionForEfficiency
+##        return float(stringWidth(word, self.fontName, self.fontSize))
+
+    def fitLine(self, program, totalLength):
+        "fit words (and other things) onto a line"
+        # assuming word lengths and spaces have not been yet added
+        # fit words onto a line up to maxlength, adding spaces and respecting extra space
+        from reportlab.pdfbase.pdfmetrics import stringWidth
+        usedIndent = self.indent
+        maxLength = totalLength - usedIndent - self.rightIndent
+        done = 0
+        line = []
+        cursor = 0
+        lineIsFull = 0
+        currentLength = 0
+        maxcursor = len(program)
+        needspace = 0
+        first = 1
+        terminated = None
+        fontName = self.fontName
+        fontSize = self.fontSize
+        spacewidth = stringWidth(" ", fontName, fontSize) #self.sizeOfWord(" ")
+        justStrings = 1
+        while not done and cursor<maxcursor:
+            opcode = program[cursor]
+            #if debug: print "opcode", cursor, opcode
+            topcode = type(opcode)
+            if topcode in (StringType, UnicodeType, InstanceType):
+                lastneedspace = needspace
+                needspace = 0
+                if topcode is InstanceType:
+                    justStrings = 0
+                    width = opcode.width(self)
+                    needspace = 0
+                else:
+                    saveopcode = opcode
+                    opcode = opcode.strip()
+                    if opcode:
+                        width = stringWidth(opcode, fontName, fontSize)
+                    else:
+                        width = 0
+                    if saveopcode and (width or currentLength):
+                        # ignore white space at margin
+                        needspace = (saveopcode[-1]==" ")
+                    else:
+                        needspace = 0
+                fullwidth = width
+                if lastneedspace:
+                    #spacewidth = stringWidth(" ", fontName, fontSize) #self.sizeOfWord(" ")
+                    fullwidth = width + spacewidth
+                newlength = currentLength+fullwidth
+                if newlength>maxLength and not first: # always do at least one thing
+                    # this word won't fit
+                    #if debug:
+                    #    print "WORD", opcode, "wont fit, width", width, "fullwidth", fullwidth
+                    #    print "   currentLength", currentLength, "newlength", newlength, "maxLength", maxLength
+                    done = 1
+                    lineIsFull = 1
+                else:
+                    # fit the word: add a space then the word
+                    if lastneedspace:
+                        line.append( spacewidth ) # expandable space: positive
+                    if opcode:
+                        line.append( opcode )
+                    if abs(width)>TOOSMALLSPACE:
+                        line.append( -width ) # non expanding space: negative
+                        currentLength = newlength
+                    #print line
+                    #stop
+                first = 0
+            elif topcode is FloatType:
+                justStrings = 0
+                aopcode = abs(opcode) # negative means non expanding
+                if aopcode>TOOSMALLSPACE:
+                    nextLength = currentLength+aopcode
+                    if nextLength>maxLength and not first: # always do at least one thing
+                        #if debug: print "EXPLICIT spacer won't fit", maxLength, nextLength, opcode
+                        done = 1
+                    else:
+                        if aopcode>TOOSMALLSPACE:
+                            currentLength = nextLength
+                            line.append(opcode)
+                    first = 0
+            elif topcode is  TupleType:
+                justStrings = 0
+                indicator = opcode[0]
+                #line.append(opcode)
+                if indicator=="nextLine":
+                    # advance to nextLine
+                    #(i, endallmarks) = opcode
+                    line.append(opcode)
+                    cursor = cursor+1 # consume this element
+                    terminated = done = 1
+                    #if debug:
+                    #    print "nextLine encountered"
+                elif indicator=="color":
+                    # change fill color
+                    oldcolor = self.fontColor
+                    (i, colorname) = opcode
+                    #print "opcode", opcode
+                    if type(colorname) in (StringType, UnicodeType):
+                        color = self.fontColor = colors.toColor(colorname)
+                    else:
+                        color = self.fontColor = colorname # assume its something sensible :)
+                    line.append(opcode)
+                elif indicator=="face":
+                    # change font face
+                    (i, fontname) = opcode
+                    fontName = self.fontName = fontname
+                    spacewidth = stringWidth(" ", fontName, fontSize) #self.sizeOfWord(" ")
+                    line.append(opcode)
+                elif indicator=="size":
+                    # change font size
+                    (i, fontsize) = opcode
+                    size = abs(float(fontsize))
+                    if type(fontsize) in (StringType, UnicodeType):
+                        if fontsize[:1]=="+":
+                            fontSize = self.fontSize = self.fontSize + size
+                        elif fontsize[:1]=="-":
+                            fontSize = self.fontSize = self.fontSize - size
+                        else:
+                            fontSize = self.fontSize = size
+                    else:
+                        fontSize = self.fontSize = size
+                    spacewidth = stringWidth(" ", fontName, fontSize) #self.sizeOfWord(" ")
+                    line.append(opcode)
+                elif indicator=="leading":
+                    # change font leading
+                    (i, leading) = opcode
+                    self.leading = leading
+                    line.append(opcode)
+                elif indicator=="indent":
+                    # increase the indent
+                    (i, increment) = opcode
+                    indent = self.indent = self.indent + increment
+                    if first:
+                        usedIndent = max(indent, usedIndent)
+                        maxLength = totalLength - usedIndent - self.rightIndent
+                    line.append(opcode)
+                elif indicator=="push":
+                    self.pushTextState()
+                    line.append(opcode)
+                elif indicator=="pop":
+                    try:
+                        self.popTextState()
+                    except:
+##                        print "stack fault near", cursor
+##                        for i in program[max(0, cursor-10):cursor+10]:
+##                            if i==cursor:
+##                                print "***>>>",
+##                            print i
+                        raise
+                    fontName = self.fontName
+                    fontSize = self.fontSize
+                    spacewidth = stringWidth(" ", fontName, fontSize) #self.sizeOfWord(" ")
+                    line.append(opcode)
+                elif indicator=="bullet":
+                    (i, bullet, indent, font, size) = opcode
+                    # adjust for base indent (only at format time -- only execute once)
+                    indent = indent + self.baseindent
+                    opcode = (i, bullet, indent, font, size)
+                    if not first:
+                        raise ValueError, "bullet not at beginning of line"
+                    bulletwidth = float(stringWidth(bullet, font, size))
+                    spacewidth = float(stringWidth(" ", font, size))
+                    bulletmin = indent+spacewidth+bulletwidth
+                    # decrease the line size to allow bullet
+                    usedIndent = max(bulletmin, usedIndent)
+                    if first:
+                        maxLength = totalLength - usedIndent - self.rightIndent
+                    line.append(opcode)
+                elif indicator=="rightIndent":
+                    # increase the right indent
+                    (i, increment) = opcode
+                    self.rightIndent = self.rightIndent+increment
+                    if first:
+                        maxLength = totalLength - usedIndent - self.rightIndent
+                    line.append(opcode)
+                elif indicator=="rise":
+                    (i, rise) = opcode
+                    newrise = self.rise = self.rise+rise
+                    line.append(opcode)
+                elif indicator=="align":
+                    (i, alignment) = opcode
+                    #if debug:
+                    #    print "SETTING ALIGNMENT", alignment
+                    self.alignment = alignment
+                    line.append(opcode)
+                elif indicator=="lineOperation":
+                    (i, handler) = opcode
+                    line.append(opcode)
+                    self.lineOpHandlers = self.lineOpHandlers + [handler] # fresh copy
+                elif indicator=="endLineOperation":
+                    (i, handler) = opcode
+                    h = self.lineOpHandlers[:] # fresh copy
+                    h.remove(handler)
+                    self.lineOpHandlers = h
+                    line.append(opcode)
+
+                else:
+                    raise ValueError, "at format time don't understand indicator "+repr(indicator)
+            else:
+                raise ValueError, "op must be string, float, instance, or tuple "+repr(opcode)
+            if not done:
+                cursor = cursor+1
+                #first = 0
+##            if debug:
+##                if done:
+##                    print "DONE FLAG IS SET"
+##                if cursor>=maxcursor:
+##                    print "AT END OF PROGRAM"
+        if not terminated:
+            line.append( ("nextLine", 0) )
+        #print "fitline", line
+        return (lineIsFull, line, cursor, currentLength, usedIndent, maxLength, justStrings)
+
+    def centerAlign(self, line, lineLength, maxLength):
+        diff = maxLength-lineLength
+        shift = diff/2.0
+        if shift>TOOSMALLSPACE:
+            return self.insertShift(line, shift)
+        return line
+
+    def rightAlign(self, line, lineLength, maxLength):
+        shift = maxLength-lineLength
+        #die
+        if shift>TOOSMALLSPACE:
+            return self.insertShift(line, shift)
+        return line
+
+    def insertShift(self, line, shift):
+        # insert shift just before first visible element in line
+        result = []
+        first = 1
+        for e in line:
+            te = type(e)
+            if first and (te in (StringType, UnicodeType, InstanceType)):
+                result.append(shift)
+                first = 0
+            result.append(e)
+        return result
+
+    def justifyAlign(self, line, lineLength, maxLength):
+        diff = maxLength-lineLength
+        # count EXPANDABLE SPACES AFTER THE FIRST VISIBLE
+        spacecount = 0
+        visible = 0
+        for e in line:
+            te = type(e)
+            if te is FloatType and e>TOOSMALLSPACE and visible:
+                spacecount = spacecount+1
+            elif te in (StringType, UnicodeType, InstanceType):
+                visible = 1
+        #if debug: print "diff is", diff, "wordcount", wordcount #; die
+        if spacecount<1:
+            return line
+        shift = diff/float(spacecount)
+        if shift<=TOOSMALLSPACE:
+            #if debug: print "shift too small", shift
+            return line
+        first = 1
+        visible = 0
+        result = []
+        cursor = 0
+        nline = len(line)
+        while cursor<nline:
+            e = line[cursor]
+            te = type(e)
+            result.append(e)
+            if (te in (StringType, UnicodeType, InstanceType)):
+                visible = 1
+            elif te is FloatType and e>TOOSMALLSPACE and visible:
+                expanded = e+shift
+                result[-1] = expanded
+            cursor = cursor+1
+        return result
+
+##                if not first:
+##                    #if debug: print "shifting", shift, e
+##                    #result.append(shift)
+##                    # add the shift in result before any start markers before e
+##                    insertplace = len(result)-1
+##                    done = 0
+##                    myshift = shift
+##                    while insertplace>0 and not done:
+##                        beforeplace = insertplace-1
+##                        beforething = result[beforeplace]
+##                        thingtype = type(beforething)
+##                        if thingtype is TupleType:
+##                            indicator = beforething[0]
+##                            if indicator=="endLineOperation":
+##                                done = 1
+##                            elif debug:
+##                                print "adding shift before", beforething
+##                        elif thingtype is FloatType:
+##                            myshift = myshift + beforething
+##                            del result[beforeplace]
+##                        else:
+##                            done = 1
+##                        if not done:
+##                            insertplace = beforeplace
+##                    result.insert(insertplace, myshift)
+##                first = 0
+##            cursor = cursor+1
+##        return result
+
+    def shrinkWrap(self, line):
+        # for non justified text, collapse adjacent text/shift's into single operations
+        result = []
+        index = 0
+        maxindex = len(line)
+        while index<maxindex:
+            e = line[index]
+            te = type(e)
+            if te in (StringType, UnicodeType) and index<maxindex-1:
+                # collect strings and floats
+                thestrings = [e]
+                thefloats = 0.0
+                index = index+1
+                nexte = line[index]
+                tnexte = type(nexte)
+                while index<maxindex and (tnexte in (FloatType, StringType, UnicodeType)):
+                    # switch to expandable space if appropriate
+                    if tnexte is FloatType:
+                        if thefloats<0 and nexte>0:
+                            thefloats = -thefloats
+                        if nexte<0 and thefloats>0:
+                            nexte = -nexte
+                        thefloats = thefloats + nexte
+                    elif tnexte in (StringType, UnicodeType):
+                        thestrings.append(nexte)
+                    index = index+1
+                    if index<maxindex:
+                        nexte = line[index]
+                        tnexte = type(nexte)
+                # wrap up the result
+                s = ' '.join(thestrings)
+                result.append(s)
+                result.append(float(thefloats))
+                # back up for unhandled element
+                index = index-1
+            else:
+                result.append(e)
+            index = index+1
+
+        return result
+
+    def cleanProgram(self, line):
+        "collapse adjacent spacings"
+        #return line # for debugging
+        result = []
+        last = 0
+        for e in line:
+            if type(e) is FloatType:
+                # switch to expandable space if appropriate
+                if last<0 and e>0:
+                    last = -last
+                if e<0 and last>0:
+                    e = -e
+                last = float(last)+e
+            else:
+                if abs(last)>TOOSMALLSPACE:
+                    result.append(last)
+                result.append(e)
+                last = 0
+        if last:
+            result.append(last)
+        # now go backwards and delete all floats occurring after all visible elements
+##        count = len(result)-1
+##        done = 0
+##        while count>0 and not done:
+##            e = result[count]
+##            te = type(e)
+##            if te is StringType or te is InstanceType or te is TupleType:
+##                done = 1
+##            elif te is FloatType:
+##                del result[count]
+##            count = count-1
+        # move end operations left and start operations left up to visibles
+        change = 1
+        rline = range(len(result)-1)
+        while change:
+            #print line
+            change = 0
+            for index in rline:
+                nextindex = index+1
+                this = result[index]
+                next = result[nextindex]
+                doswap = 0
+                tthis = type(this)
+                tnext = type(next)
+                # don't swap visibles
+                if tthis in (StringType, UnicodeType) or \
+                   tnext in (StringType, UnicodeType) or \
+                   this is InstanceType or tnext is InstanceType:
+                    doswap = 0
+                # only swap two tuples if the second one is an end operation and the first is something else
+                elif tthis is TupleType:
+                    thisindicator = this[0]
+                    if tnext is TupleType:
+                        nextindicator = next[0]
+                        doswap = 0
+                        if (nextindicator=="endLineOperation" and thisindicator!="endLineOperation"
+                            and thisindicator!="lineOperation"):
+                            doswap = 1 # swap nonend<>end
+                    elif tnext==FloatType:
+                        if thisindicator=="lineOperation":
+                            doswap = 1 # begin <> space
+                if doswap:
+                    #print "swap", line[index],line[nextindex]
+                    result[index] = next
+                    result[nextindex] = this
+                    change = 1
+        return result
+
+    def runOpCodes(self, program, canvas, textobject):
+        "render the line(s)"
+
+        escape = canvas._escape
+        code = textobject._code
+        startstate = self.__dict__.copy()
+        font = None
+        size = None
+        # be sure to set them before using them (done lazily below)
+        #textobject.setFont(self.fontName, self.fontSize)
+        textobject.setFillColor(self.fontColor)
+        xstart = self.x
+        thislineindent = self.indent
+        thislinerightIndent = self.rightIndent
+        indented = 0
+        for opcode in program:
+            topcode = type(opcode)
+            if topcode in (StringType, UnicodeType, InstanceType):
+                if not indented:
+                    if abs(thislineindent)>TOOSMALLSPACE:
+                        #if debug: print "INDENTING", thislineindent
+                        #textobject.moveCursor(thislineindent, 0)
+                        code.append('%s Td' % fp_str(thislineindent, 0))
+                        self.x = self.x + thislineindent
+                    for handler in self.lineOpHandlers:
+                        #handler.end_at(x, y, self, canvas, textobject) # finish, eg, underlining this line
+                        handler.start_at(self.x, self.y, self, canvas, textobject) # start underlining the next
+                indented = 1
+                # lazily set font (don't do it again if not needed)
+                if font!=self.fontName or size!=self.fontSize:
+                    font = self.fontName
+                    size = self.fontSize
+                    textobject.setFont(font, size)
+                if topcode in (StringType, UnicodeType):
+                    #textobject.textOut(opcode)
+                    text = escape(opcode)
+                    code.append('(%s) Tj' % text)
+                else:
+                    # drawable thing
+                    opcode.execute(self, textobject, canvas)
+            elif topcode is FloatType:
+                # use abs value (ignore expandable marking)
+                opcode = abs(opcode)
+                if opcode>TOOSMALLSPACE:
+                    #textobject.moveCursor(opcode, 0)
+                    code.append('%s Td' % fp_str(opcode, 0))
+                    self.x = self.x + opcode
+            elif topcode is TupleType:
+                indicator = opcode[0]
+                if indicator=="nextLine":
+                    # advance to nextLine
+                    (i, endallmarks) = opcode
+                    x = self.x
+                    y = self.y
+                    newy = self.y = self.y-self.leading
+                    newx = self.x = xstart
+                    thislineindent = self.indent
+                    thislinerightIndent = self.rightIndent
+                    indented = 0
+                    for handler in self.lineOpHandlers:
+                        handler.end_at(x, y, self, canvas, textobject) # finish, eg, underlining this line
+                        #handler.start_at(newx, newy, self, canvas, textobject)) # start underlining the next
+                    textobject.setTextOrigin(newx, newy)
+                elif indicator=="color":
+                    # change fill color
+                    oldcolor = self.fontColor
+                    (i, colorname) = opcode
+                    #print "opcode", opcode
+                    if type(colorname) in (StringType, UnicodeType):
+                        color = self.fontColor = colors.toColor(colorname)
+                    else:
+                        color = self.fontColor = colorname # assume its something sensible :)
+                    #if debug:
+                    #    print color.red, color.green, color.blue
+                    #    print dir(color)
+                    #print "color is", color
+                    #from reportlab.lib.colors import green
+                    #if color is green: print "color is green"
+                    if color!=oldcolor:
+                        textobject.setFillColor(color)
+                elif indicator=="face":
+                    # change font face
+                    (i, fontname) = opcode
+                    self.fontName = fontname
+                    #textobject.setFont(self.fontName, self.fontSize)
+                elif indicator=="size":
+                    # change font size
+                    (i, fontsize) = opcode
+                    size = abs(float(fontsize))
+                    if type(fontsize) in (StringType, UnicodeType):
+                        if fontsize[:1]=="+":
+                            fontSize = self.fontSize = self.fontSize + size
+                        elif fontsize[:1]=="-":
+                            fontSize = self.fontSize = self.fontSize - size
+                        else:
+                            fontSize = self.fontSize = size
+                    else:
+                        fontSize = self.fontSize = size
+                    #(i, fontsize) = opcode
+                    self.fontSize = fontSize
+                    textobject.setFont(self.fontName, self.fontSize)
+                elif indicator=="leading":
+                    # change font leading
+                    (i, leading) = opcode
+                    self.leading = leading
+                elif indicator=="indent":
+                    # increase the indent
+                    (i, increment) = opcode
+                    indent = self.indent = self.indent + increment
+                    thislineindent = max(thislineindent, indent)
+                elif indicator=="push":
+                    self.pushTextState()
+                elif indicator=="pop":
+                    oldcolor = self.fontColor
+                    oldfont = self.fontName
+                    oldsize = self.fontSize
+                    self.popTextState()
+                    #if CAUSEERROR or oldfont!=self.fontName or oldsize!=self.fontSize:
+                    #    textobject.setFont(self.fontName, self.fontSize)
+                    if oldcolor!=self.fontColor:
+                        textobject.setFillColor(self.fontColor)
+                elif indicator=="wordSpacing":
+                    (i, ws) = opcode
+                    textobject.setWordSpace(ws)
+                elif indicator=="bullet":
+                    (i, bullet, indent, font, size) = opcode
+                    if abs(self.x-xstart)>TOOSMALLSPACE:
+                        raise ValueError, "bullet not at beginning of line"
+                    bulletwidth = float(stringWidth(bullet, font, size))
+                    spacewidth = float(stringWidth(" ", font, size))
+                    bulletmin = indent+spacewidth+bulletwidth
+                    # decrease the line size to allow bullet as needed
+                    if bulletmin > thislineindent:
+                        #if debug: print "BULLET IS BIG", bullet, bulletmin, thislineindent
+                        thislineindent = bulletmin
+                    textobject.moveCursor(indent, 0)
+                    textobject.setFont(font, size)
+                    textobject.textOut(bullet)
+                    textobject.moveCursor(-indent, 0)
+                    #textobject.textOut("M")
+                    textobject.setFont(self.fontName, self.fontSize)
+                elif indicator=="rightIndent":
+                    # increase the right indent
+                    (i, increment) = opcode
+                    self.rightIndent = self.rightIndent+increment
+                elif indicator=="rise":
+                    (i, rise) = opcode
+                    newrise = self.rise = self.rise+rise
+                    textobject.setRise(newrise)
+                elif indicator=="align":
+                    (i, alignment) = opcode
+                    self.alignment = alignment
+                elif indicator=="lineOperation":
+                    (i, handler) = opcode
+                    handler.start_at(self.x, self.y, self, canvas, textobject)
+                    #self.lineOpHandlers.append(handler)
+                    #if debug: print "adding", handler, self.lineOpHandlers
+                    self.lineOpHandlers = self.lineOpHandlers + [handler] # fresh copy!
+                elif indicator=="endLineOperation":
+                    (i, handler) = opcode
+                    handler.end_at(self.x, self.y, self, canvas, textobject)
+                    newh = self.lineOpHandlers = self.lineOpHandlers[:] # fresh copy
+                    #if debug: print "removing", handler, self.lineOpHandlers
+                    if handler in newh:
+                        self.lineOpHandlers.remove(handler)
+                    else:
+                        pass
+                        #print "WARNING: HANDLER", handler, "NOT IN", newh
+                else:
+                    raise ValueError, "don't understand indicator "+repr(indicator)
+            else:
+                raise ValueError, "op must be string float or tuple "+repr(opcode)
+        laststate = self.__dict__.copy()
+        #self.resetState(startstate)
+        self.__dict__.update(startstate)
+        return laststate
+
+def stringLine(line, length):
+    "simple case: line with just strings and spacings which can be ignored"
+
+    strings = []
+    for x in line:
+        if type(x) in (StringType, UnicodeType):
+            strings.append(x)
+    text = ' '.join(strings)
+    result = [text, float(length)]
+    nextlinemark = ("nextLine", 0)
+    if line and line[-1]==nextlinemark:
+        result.append( nextlinemark )
+    return result
+
+def simpleJustifyAlign(line, currentLength, maxLength):
+    "simple justification with only strings"
+
+    strings = []
+    for x in line[:-1]:
+        if type(x) in (StringType, UnicodeType):
+            strings.append(x)
+    nspaces = len(strings)-1
+    slack = maxLength-currentLength
+    text = ' '.join(strings)
+    if nspaces>0 and slack>0:
+        wordspacing = slack/float(nspaces)
+        result = [("wordSpacing", wordspacing), text, maxLength, ("wordSpacing", 0)]
+    else:
+        result = [text, currentLength, ("nextLine", 0)]
+    nextlinemark = ("nextLine", 0)
+    if line and line[-1]==nextlinemark:
+        result.append( nextlinemark )
+    return result
+
+from reportlab.lib.colors import black
+
+def readBool(text):
+    if text.upper() in ("Y", "YES", "TRUE", "1"):
+        return 1
+    elif text.upper() in ("N", "NO", "FALSE", "0"):
+        return 0
+    else:
+        raise RMLError, "true/false attribute has illegal value '%s'" % text
+
+def readAlignment(text):
+    up = text.upper()
+    if up == 'LEFT':
+        return TA_LEFT
+    elif up == 'RIGHT':
+        return TA_RIGHT
+    elif up in ['CENTER', 'CENTRE']:
+        return TA_CENTER
+    elif up == 'JUSTIFY':
+        return TA_JUSTIFY
+
+def readLength(text):
+    """Read a dimension measurement: accept "3in", "5cm",
+    "72 pt" and so on."""
+    text = text.strip()
+    try:
+        return float(text)
+    except ValueError:
+        text = text.lower()
+        numberText, units = text[:-2],text[-2:]
+        numberText = numberText.strip()
+        try:
+            number = float(numberText)
+        except ValueError:
+            raise ValueError, "invalid length attribute '%s'" % text
+        try:
+            multiplier = {
+                'in':72,
+                'cm':28.3464566929,  #72/2.54; is this accurate?
+                'mm':2.83464566929,
+                'pt':1
+                }[units]
+        except KeyError:
+            raise RMLError, "invalid length attribute '%s'" % text
+
+        return number * multiplier
+
+def lengthSequence(s, converter=readLength):
+    """from "(2, 1)" or "2,1" return [2,1], for example"""
+    s = s.strip()
+    if s[:1]=="(" and s[-1:]==")":
+        s = s[1:-1]
+    sl = s.split(',')
+    sl = [s.strip() for s in sl]
+    sl = [converter(s) for s in sl]
+    return sl
+
+
+def readColor(text):
+    """Read color names or tuples, RGB or CMYK, and return a Color object."""
+    if not text:
+        return None
+    from reportlab.lib import colors
+    from string import letters
+    if text[0] in letters:
+        return colors.__dict__[text]
+    tup = lengthSequence(text)
+
+    msg = "Color tuple must have 3 (or 4) elements for RGB (or CMYC)."
+    assert 3 <= len(tup) <= 4, msg
+    msg = "Color tuple must have all elements <= 1.0."
+    for i in range(len(tup)):
+        assert tup[i] <= 1.0, msg
+
+    if len(tup) == 3:
+        colClass = colors.Color
+    elif len(tup) == 4:
+        colClass = colors.CMYKColor
+    return apply(colClass, tup)
+
+class StyleAttributeConverters:
+    fontSize=[readLength]
+    leading=[readLength]
+    leftIndent=[readLength]
+    rightIndent=[readLength]
+    firstLineIndent=[readLength]
+    alignment=[readAlignment]
+    spaceBefore=[readLength]
+    spaceAfter=[readLength]
+    bulletFontSize=[readLength]
+    bulletIndent=[readLength]
+    textColor=[readColor]
+    backColor=[readColor]
+
+class SimpleStyle:
+    "simplified paragraph style without all the fancy stuff"
+    name = "basic"
+    fontName='Times-Roman'
+    fontSize=10
+    leading=12
+    leftIndent=0
+    rightIndent=0
+    firstLineIndent=0
+    alignment=TA_LEFT
+    spaceBefore=0
+    spaceAfter=0
+    bulletFontName='Times-Roman'
+    bulletFontSize=10
+    bulletIndent=0
+    textColor=black
+    backColor=None
+
+    def __init__(self, name, parent=None, **kw):
+        mydict = self.__dict__
+        if parent:
+            for (a,b) in parent.__dict__.items():
+                mydict[a]=b
+        for (a,b) in kw.items():
+            mydict[a] =  b
+
+    def addAttributes(self, dictionary):
+        for key in dictionary.keys():
+            value = dictionary[key]
+            if value is not None:
+                if hasattr(StyleAttributeConverters, key):
+                    converter = getattr(StyleAttributeConverters, key)[0]
+                    value = converter(value)
+                setattr(self, key, value)
+
+
+DEFAULT_ALIASES = {
+    "h1.defaultStyle": "Heading1",
+    "h2.defaultStyle": "Heading2",
+    "h3.defaultStyle": "Heading3",
+    "h4.defaultStyle": "Heading4",
+    "h5.defaultStyle": "Heading5",
+    "h6.defaultStyle": "Heading6",
+    "title.defaultStyle": "Title",
+    "subtitle.defaultStyle": "SubTitle",
+    "para.defaultStyle": "Normal",
+    "pre.defaultStyle": "Code",
+    "ul.defaultStyle": "UnorderedList",
+    "ol.defaultStyle": "OrderedList",
+    "li.defaultStyle": "Definition",
+    }
+
+class FastPara(Flowable):
+    "paragraph with no special features (not even a single ampersand!)"
+
+    def __init__(self, style, simpletext):
+        #if debug:
+        #    print "FAST", id(self)
+        if "&" in simpletext:
+            raise ValueError, "no ampersands please!"
+        self.style = style
+        self.simpletext = simpletext
+        self.lines = None
+
+    def wrap(self, availableWidth, availableHeight):
+        simpletext = self.simpletext
+        self.availableWidth = availableWidth
+        style = self.style
+        text = self.simpletext
+        rightIndent = style.rightIndent
+        leftIndent = style.leftIndent
+        leading = style.leading
+        font = style.fontName
+        size = style.fontSize
+        firstindent = style.firstLineIndent
+        #textcolor = style.textColor
+        words = simpletext.split()
+        lines = []
+        from reportlab.pdfbase.pdfmetrics import stringWidth
+        spacewidth = stringWidth(" ", font, size)
+        currentline = []
+        currentlength = 0
+        firstmaxlength = availableWidth - rightIndent - firstindent
+        maxlength = availableWidth - rightIndent - leftIndent
+        if maxlength<spacewidth:
+            return (spacewidth+rightIndent+firstindent, availableHeight) # need something wider than this!
+        if availableHeight<leading:
+            return (availableWidth, leading) # need something longer
+        if self.lines is None:
+            heightused = 0
+            cursor = 0
+            nwords = len(words)
+            done = 0
+            #heightused = leading # ???
+            while cursor<nwords and not done:
+                thismaxlength = maxlength
+                if not lines:
+                    thismaxlength = firstmaxlength
+                thisword = words[cursor]
+                thiswordsize = stringWidth(thisword, font, size)
+                if currentlength:
+                    thiswordsize = thiswordsize+spacewidth
+                nextlength = currentlength + thiswordsize
+                if not currentlength or nextlength<maxlength:
+                    # add the word
+                    cursor = cursor+1
+                    currentlength = nextlength
+                    currentline.append(thisword)
+                    #print "currentline", currentline
+                else:
+                    # emit the line
+                    lines.append( (' '.join(currentline), currentlength, len(currentline)) )
+                    currentline = []
+                    currentlength = 0
+                    heightused = heightused+leading
+                    if heightused+leading>availableHeight:
+                        done = 1
+            if currentlength and not done:
+                lines.append( (' '.join(currentline), currentlength, len(currentline) ))
+                heightused = heightused+leading
+            self.lines = lines
+            self.height = heightused
+            remainder = self.remainder = ' '.join(words[cursor:])
+            #print "lines", lines
+            #print "remainder is", remainder
+        else:
+            remainder = None
+            heightused = self.height
+            lines = self.lines
+        if remainder:
+            result = (availableWidth, availableHeight+leading) # need to split
+        else:
+            result = (availableWidth, heightused)
+        #if debug: print "wrap is", (availableWidth, availableHeight), result, len(lines)
+        return result
+
+    def split(self, availableWidth, availableHeight):
+        style = self.style
+        leading = style.leading
+        if availableHeight<leading:
+            return [] # not enough space for split
+        lines = self.lines
+        if lines is None:
+            raise ValueError, "must wrap before split"
+        remainder = self.remainder
+        if remainder:
+            next = FastPara(style, remainder)
+            return [self,next]
+        else:
+            return [self]
+
+    def draw(self):
+        style = self.style
+        lines = self.lines
+        rightIndent = style.rightIndent
+        leftIndent = style.leftIndent
+        leading = style.leading
+        font = style.fontName
+        size = style.fontSize
+        alignment = style.alignment
+        firstindent = style.firstLineIndent
+        c = self.canv
+        escape = c._escape
+        #if debug:
+        #    print "FAST", id(self), "page number", c.getPageNumber()
+        height = self.height
+        #if debug:
+        #    c.rect(0,0,-1, height-size, fill=1, stroke=1)
+        c.translate(0, height-size)
+        textobject = c.beginText()
+        code = textobject._code
+        #textobject.setTextOrigin(0,firstindent)
+        textobject.setFont(font, size)
+        if style.textColor:
+            textobject.setFillColor(style.textColor)
+        first = 1
+        y = 0
+        basicWidth = self.availableWidth - rightIndent
+        count = 0
+        nlines = len(lines)
+        while count<nlines:
+            (text, length, nwords) = lines[count]
+            count = count+1
+            thisindent = leftIndent
+            if first:
+                thisindent = firstindent
+            if alignment==TA_LEFT:
+                x = thisindent
+            elif alignment==TA_CENTER:
+                extra = basicWidth - length
+                x = thisindent + extra/2.0
+            elif alignment==TA_RIGHT:
+                extra = basicWidth - length
+                x = thisindent + extra
+            elif alignment==TA_JUSTIFY:
+                x = thisindent
+                if count<nlines and nwords>1:
+                    # patch from doug at pennatus.com, 9 Nov 2002, no extraspace on last line
+                    textobject.setWordSpace((basicWidth-length)/(nwords-1.0))
+                else:
+                    textobject.setWordSpace(0.0)
+            textobject.setTextOrigin(x,y)
+            text = escape(text)
+            code.append('(%s) Tj' % text)
+            #textobject.textOut(text)
+            y = y-leading
+        c.drawText(textobject)
+
+    def getSpaceBefore(self):
+        #if debug:
+        #    print "got space before", self.spaceBefore
+        return self.style.spaceBefore
+
+    def getSpaceAfter(self):
+        #print "got space after", self.spaceAfter
+        return self.style.spaceAfter
+
+
+def defaultContext():
+    result = {}
+    from Paragraph import getDefaultStyleSheet
+    styles = getDefaultStyleSheet()
+    for (stylenamekey, stylenamevalue) in DEFAULT_ALIASES.items():
+        result[stylenamekey] = styles[stylenamevalue]
+    return result
+
+
+def buildContext(stylesheet=None):
+    result = {}
+    if stylesheet is not None:
+        for key, value in stylesheet.items():
+            result[key] = value
+        # Then make aliases
+        for (stylenamekey, stylenamevalue) in DEFAULT_ALIASES.items():
+            if stylesheet.has_key(stylenamevalue):
+                result[stylenamekey] = stylesheet[stylenamevalue]
+    return result
+
+
+class Para(Flowable):
+
+    spaceBefore = 0
+    spaceAfter = 0
+
+    def __init__(self, style, parsedText=None, bulletText=None, state=None, context=None, baseindent=0):
+        #print id(self), "para", parsedText
+        self.baseindent = baseindent
+        self.context = buildContext(context)
+        self.parsedText = parsedText
+        self.bulletText = bulletText
+        self.style1 = style # make sure Flowable doesn't use this unless wanted! call it style1 NOT style
+        #self.spaceBefore = self.spaceAfter = 0
+        self.program = [] # program before layout
+        self.formattedProgram = [] # after layout
+        self.remainder = None # follow on paragraph if any
+        self.state = state # initial formatting state (for completions)
+        if not state:
+            self.spaceBefore = style.spaceBefore
+            self.spaceAfter = style.spaceAfter
+            #self.spaceBefore = "invalid value"
+        #if hasattr(self, "spaceBefore") and debug:
+        #    print "spaceBefore is", self.spaceBefore, self.parsedText
+        self.bold = 0
+        self.italic = 0
+        self.face = style.fontName
+        self.size = style.fontSize
+
+    def getSpaceBefore(self):
+        #if debug:
+        #    print "got space before", self.spaceBefore
+        return self.spaceBefore
+
+    def getSpaceAfter(self):
+        #print "got space after", self.spaceAfter
+        return self.spaceAfter
+
+    def wrap(self, availableWidth, availableHeight):
+        #if debug:
+        #    print "WRAPPING", availableWidth, availableHeight
+        #    print "  ", self.formattedProgram
+        #    print "  ", self.program
+
+        self.availableHeight = availableHeight
+        self.myengine = p = paragraphEngine()
+        p.baseindent = self.baseindent # for shifting bullets as needed
+        parsedText = self.parsedText
+        formattedProgram = self.formattedProgram
+        state = self.state
+        if state:
+            leading = state["leading"]
+        else:
+            leading = self.style1.leading
+        program = self.program
+        self.cansplit = 1 # until proven otherwise
+        if state:
+            p.resetState(state)
+            p.x = 0
+            p.y = 0
+            needatleast = state["leading"]
+        else:
+            needatleast = self.style1.leading
+        if availableHeight<=needatleast:
+            self.cansplit = 0
+            #if debug:
+            #    print "CANNOT COMPILE, NEED AT LEAST", needatleast, 'AVAILABLE', availableHeight
+            return (availableWidth, needatleast+1) # cannot split
+        if parsedText is None and program is None:
+            raise ValueError, "need parsedText for formatting"
+        if not program:
+            self.program = program = self.compileProgram(parsedText)
+        if not self.formattedProgram:
+            (formattedProgram, remainder, \
+             laststate, heightused) = p.format(availableWidth, availableHeight, program, leading)
+            self.formattedProgram = formattedProgram
+            self.height = heightused
+            self.laststate = laststate
+            self.remainderProgram = remainder
+        else:
+            heightused = self.height
+            remainder = None
+        # too big if there is a remainder
+        if remainder:
+            # lie about the height: it must be split anyway
+            #if debug:
+            #    print "I need to split", self.formattedProgram
+            #    print "heightused", heightused, "available", availableHeight, "remainder", len(remainder)
+            height = availableHeight + 1
+            #print "laststate is", laststate
+            #print "saving remainder", remainder
+            self.remainder = Para(self.style1, parsedText=None, bulletText=None, \
+                                  state=laststate, context=self.context)
+            self.remainder.program = remainder
+            self.remainder.spaceAfter = self.spaceAfter
+            self.spaceAfter = 0
+        else:
+            self.remainder = None # no extra
+            height = heightused
+            if height>availableHeight:
+                height = availableHeight-0.1
+            #if debug:
+            #    print "giving height", height, "of", availableHeight, self.parsedText
+        result = (availableWidth, height)
+        if debug:
+            (w, h) = result
+            if abs(availableHeight-h)<0.2:
+                print "exact match???" , (availableHeight, h)
+            print "wrap is", (availableWidth, availableHeight), result
+        return result
+
+    def split(self, availableWidth, availableHeight):
+        #if debug:
+        #    print "SPLITTING", id(self), availableWidth, availableHeight
+        if availableHeight<=0 or not self.cansplit:
+            #if debug:
+            #    print "cannot split", availableWidth, "too small"
+            return [] # wrap failed to find a split
+        self.availableHeight = availableHeight
+        formattedProgram = self.formattedProgram
+        #print "formattedProgram is", formattedProgram
+        if formattedProgram is None:
+            raise ValueError, "must call wrap before split"
+        elif not formattedProgram:
+            # no first line in self: fail to split
+            return []
+        remainder = self.remainder
+        if remainder:
+            #print "SPLITTING"
+            result= [self, remainder]
+        else:
+            result= [self]
+        #if debug: print "split is", result
+        return result
+
+    def draw(self):
+        p = self.myengine #paragraphEngine()
+        formattedProgram = self.formattedProgram
+        if formattedProgram is None:
+            raise ValueError, "must call wrap before draw"
+        state = self.state
+        laststate = self.laststate
+        if state:
+            p.resetState(state)
+            p.x = 0
+            p.y = 0
+        c = self.canv
+        #if debug:
+        #    print id(self), "page number", c.getPageNumber()
+        height = self.height
+        if state:
+            leading = state["leading"]
+        else:
+            leading = self.style1.leading
+        #if debug:
+        #    c.rect(0,0,-1, height-self.size, fill=1, stroke=1)
+        c.translate(0, height-self.size)
+        t = c.beginText()
+        #t.setTextOrigin(0,0)
+        if DUMPPROGRAM or debug:
+            print "="*44, "now running program"
+            for x in formattedProgram:
+                print x
+            print "-"*44
+        laststate = p.runOpCodes(formattedProgram, c, t)
+        #print laststate["x"], laststate["y"]
+        c.drawText(t)
+
+    def compileProgram(self, parsedText, program=None):
+        style = self.style1
+        # standard parameters
+        #program = self.program
+        if program is None:
+            program = []
+        a = program.append
+        fn = style.fontName
+        # add style information if there was no initial state
+        a( ("face", fn ) )
+        from reportlab.lib.fonts import ps2tt
+        (self.face, self.bold, self.italic) = ps2tt(fn)
+        a( ("size", style.fontSize ) )
+        self.size = style.fontSize
+        a( ("align", style.alignment ) )
+        a( ("indent", style.leftIndent ) )
+        if style.firstLineIndent:
+            a( ("indent", style.firstLineIndent ) ) # must be undone later
+        a( ("rightIndent", style.rightIndent ) )
+        a( ("leading", style.leading) )
+        if style.textColor:
+            a( ("color", style.textColor) )
+        #a( ("nextLine", 0) ) # clear for next line
+        if self.bulletText:
+            self.do_bullet(self.bulletText, program)
+        self.compileComponent(parsedText, program)
+        # now look for a place where to insert the unindent after the first line
+        if style.firstLineIndent:
+            count = 0
+            for x in program:
+                count = count+1
+                tx = type(x)
+                if tx in (StringType, UnicodeType, InstanceType):
+                    break
+            program.insert( count, ("indent", -style.firstLineIndent ) ) # defaults to end if no visibles
+        #print "="*8, id(self), "program is"
+        #for x in program:
+        #    print x
+##        print "="*11
+##        # check pushes and pops
+##        stackcount = 0
+##        dump = 0
+##        for x in program:
+##            if dump:
+##                print "dump:", x
+##            if type(x) is TupleType:
+##                i = x[0]
+##                if i=="push":
+##                    stackcount = stackcount+1
+##                    print " "*stackcount, "push", stackcount
+##                if i=="pop":
+##                    stackcount = stackcount-1
+##                    print " "*stackcount, "pop", stackcount
+##                if stackcount<0:
+##                    dump=1
+##                    print "STACK UNDERFLOW!"
+##        if dump: stop
+        return program
+
+    def linearize(self, program = None, parsedText=None):
+        #print "LINEARIZING", self
+        #program = self.program = []
+        if parsedText is None:
+            parsedText = self.parsedText
+        style = self.style1
+        if program is None:
+            program = []
+        program.append( ("push",) )
+        if style.spaceBefore:
+            program.append( ("leading", style.spaceBefore+style.leading) )
+        else:
+            program.append( ("leading", style.leading) )
+        program.append( ("nextLine", 0) )
+        program = self.compileProgram(parsedText, program=program)
+        program.append( ("pop",) )
+        # go to old margin
+        program.append( ("push",) )
+        if style.spaceAfter:
+            program.append( ("leading", style.spaceAfter) )
+        else:
+            program.append( ("leading", 0) )
+        program.append( ("nextLine", 0) )
+        program.append( ("pop",) )
+
+    def compileComponent(self, parsedText, program):
+        import types
+        ttext = type(parsedText)
+        #program = self.program
+        if ttext in (StringType, UnicodeType):
+            # handle special characters here...
+            # short cut
+            if parsedText:
+                stext = parsedText.strip()
+                if not stext:
+                    program.append(" ") # contract whitespace to single space
+                else:
+                    handleSpecialCharacters(self, parsedText, program)
+        elif ttext is ListType:
+            for e in parsedText:
+                self.compileComponent(e, program)
+        elif ttext is TupleType:
+            (tagname, attdict, content, extra) = parsedText
+            if not attdict:
+                attdict = {}
+            compilername = "compile_"+tagname
+            compiler = getattr(self, compilername, None)
+            if compiler is not None:
+                compiler(attdict, content, extra, program)
+            else:
+                # just pass the tag through
+                if debug:
+                    L = [ "<" + tagname ]
+                    a = L.append
+                    if not attdict: attdict = {}
+                    for (k, v) in attdict.items():
+                        a(" %s=%s" % (k,v))
+                    if content:
+                        a(">")
+                        a(str(content))
+                        a("</%s>" % tagname)
+                    else:
+                        a("/>")
+                    t = ''.join(L)
+                    handleSpecialCharacters(self, t, program)
+                else:
+                    raise ValueError, "don't know how to handle tag " + repr(tagname)
+
+    def shiftfont(self, program, face=None, bold=None, italic=None):
+        oldface = self.face
+        oldbold = self.bold
+        olditalic = self.italic
+        oldfontinfo = (oldface, oldbold, olditalic)
+        if face is None: face = oldface
+        if bold is None: bold = oldbold
+        if italic is None: italic = olditalic
+        self.face = face
+        self.bold = bold
+        self.italic = italic
+        from reportlab.lib.fonts import tt2ps
+        font = tt2ps(face,bold,italic)
+        oldfont = tt2ps(oldface,oldbold,olditalic)
+        if font!=oldfont:
+            program.append( ("face", font ) )
+        return oldfontinfo
+
+    def fixCharacterSpacing(self, program):
+        # several tags render with nearly no space between words
+        style = self.style1
+        program.append(stringWidth(' ', style.fontName, self.size)/2)
+
+    def compile_(self, attdict, content, extra, program):
+        # "anonymous" tag: just do the content
+        for e in content:
+            self.compileComponent(e, program)
+    #compile_para = compile_ # at least for now...
+
+    def compile_pagenumber(self, attdict, content, extra, program):
+        program.append(PageNumberObject())
+
+    def compile_b(self, attdict, content, extra, program):
+        # XXX correct spacing
+        self.fixCharacterSpacing(program)
+        (f,b,i) = self.shiftfont(program, bold=1)
+        for e in content:
+            self.compileComponent(e, program)
+        self.shiftfont(program, bold=b)
+        # XXX correct spacing
+        self.fixCharacterSpacing(program)
+
+    def compile_i(self, attdict, content, extra, program):
+        (f,b,i) = self.shiftfont(program, italic=1)
+        for e in content:
+            self.compileComponent(e, program)
+        self.shiftfont(program, italic=i)
+
+    def compile_u(self, attdict, content, extra, program):
+        # XXXX must eventually add things like alternative colors
+        #program = self.program
+        program.append( ('lineOperation', UNDERLINE) )
+        for e in content:
+            self.compileComponent(e, program)
+        program.append( ('endLineOperation', UNDERLINE) )
+
+    def compile_sub(self, attdict, content, extra, program):
+        size = self.size
+        self.size = newsize = size * 0.7
+        rise = size*0.5
+        #program = self.program
+        program.append( ('size', newsize) )
+        self.size = size
+        program.append( ('rise', -rise) )
+        for e in content:
+            self.compileComponent(e, program)
+        program.append( ('size', size) )
+        program.append( ('rise', rise) )
+
+    def compile_ul(self, attdict, content, extra, program, tagname="ul"):
+        # by transformation
+        #print "compile", tagname, attdict
+        atts = attdict.copy()
+        bulletmaker = bulletMaker(tagname, atts, self.context)
+        # now do each element as a separate paragraph
+        for e in content:
+            te = type(e)
+            if te in (StringType, UnicodeType):
+                if e.strip():
+                    raise ValueError, "don't expect CDATA between list elements"
+            elif te is TupleType:
+                (tagname, attdict1, content1, extra) = e
+                if tagname!="li":
+                    raise ValueError, "don't expect %s inside list" % repr(tagname)
+                newatts = atts.copy()
+                if attdict1:
+                    newatts.update(attdict1)
+                bulletmaker.makeBullet(newatts)
+                self.compile_para(newatts, content1, extra, program)
+
+    def compile_ol(self, attdict, content, extra, program):
+        return self.compile_ul(attdict, content, extra, program, tagname="ol")
+
+    def compile_dl(self, attdict, content, extra, program):
+        # by transformation
+        #print "compile", tagname, attdict
+        atts = attdict.copy()
+        # by transformation
+        #print "compile", tagname, attdict
+        atts = attdict.copy()
+        bulletmaker = bulletMaker("dl", atts, self.context)
+        # now do each element as a separate paragraph
+        contentcopy = list(content) # copy for destruction
+        bullet = ""
+        while contentcopy:
+            e = contentcopy[0]
+            del contentcopy[0]
+            te = type(e)
+            if te in (StringType, UnicodeType):
+                if e.strip():
+                    raise ValueError, "don't expect CDATA between list elements"
+                elif not contentcopy:
+                    break # done at ending whitespace
+                else:
+                    continue # ignore intermediate whitespace
+            elif te is TupleType:
+                (tagname, attdict1, content1, extra) = e
+                if tagname!="dd" and tagname!="dt":
+                    raise ValueError, "don't expect %s here inside list, expect 'dd' or 'dt'" % \
+                          repr(tagname)
+                if tagname=="dt":
+                    if bullet:
+                        raise ValueError, "dt will not be displayed unless followed by a dd: "+repr(bullet)
+                    if content1:
+                        self.compile_para(attdict1, content1, extra, program)
+                        # raise ValueError, \
+                        # "only simple strings supported in dd content currently: "+repr(content1)
+                elif tagname=="dd":
+                    newatts = atts.copy()
+                    if attdict1:
+                        newatts.update(attdict1)
+                    bulletmaker.makeBullet(newatts, bl=bullet)
+                    self.compile_para(newatts, content1, extra, program)
+                    bullet = "" # don't use this bullet again
+        if bullet:
+            raise ValueError, "dt will not be displayed unless followed by a dd"+repr(bullet)
+
+    def compile_super(self, attdict, content, extra, program):
+        size = self.size
+        self.size = newsize = size * 0.7
+        rise = size*0.5
+        #program = self.program
+        program.append( ('size', newsize) )
+        program.append( ('rise', rise) )
+        for e in content:
+            self.compileComponent(e, program)
+        program.append( ('size', size) )
+        self.size = size
+        program.append( ('rise', -rise) )
+
+    def compile_font(self, attdict, content, extra, program):
+        #program = self.program
+        program.append( ("push",) ) # store current data
+
+        # XXX correct spacing
+        self.fixCharacterSpacing(program)
+
+        if attdict.has_key("face"):
+            face = attdict["face"]
+            from reportlab.lib.fonts import tt2ps
+            try:
+                font = tt2ps(face,self.bold,self.italic)
+            except:
+                font = face # better work!
+            program.append( ("face", font ) )
+        if attdict.has_key("color"):
+            colorname = attdict["color"]
+            program.append( ("color", colorname) )
+        if attdict.has_key("size"):
+            #size = float(attdict["size"]) # really should convert int, cm etc here!
+            size = attdict["size"]
+            program.append( ("size", size) )
+        for e in content:
+            self.compileComponent(e, program)
+        program.append( ("pop",) ) # restore as before
+
+    def compile_a(self, attdict, content, extra, program):
+        url = attdict["href"]
+        colorname = attdict.get("color", "blue")
+        #program = self.program
+        Link = HotLink(url)
+        program.append( ("push",) ) # store current data
+
+        # XXX correct spacing
+        self.fixCharacterSpacing(program)
+
+        program.append( ("color", colorname) )
+        program.append( ('lineOperation', Link) )
+        program.append( ('lineOperation', UNDERLINE) )
+        for e in content:
+            self.compileComponent(e, program)
+        program.append( ('endLineOperation', UNDERLINE) )
+        program.append( ('endLineOperation', Link) )
+
+        # XXX correct spacing
+        self.fixCharacterSpacing(program)
+
+        program.append( ("pop",) ) # restore as before
+
+    def compile_link(self, attdict, content, extra, program):
+        dest = attdict["destination"]
+        colorname = attdict.get("color", None)
+        #program = self.program
+        Link = InternalLink(dest)
+        program.append( ("push",) ) # store current data
+        if colorname:
+            program.append( ("color", colorname) )
+        program.append( ('lineOperation', Link) )
+        program.append( ('lineOperation', UNDERLINE) )
+        for e in content:
+            self.compileComponent(e, program)
+        program.append( ('endLineOperation', UNDERLINE) )
+        program.append( ('endLineOperation', Link) )
+        program.append( ("pop",) ) # restore as before
+
+    def compile_setlink(self, attdict, content, extra, program):
+        dest = attdict["destination"]
+        colorname = attdict.get("color", "blue")
+        #program = self.program
+        Link = DefDestination(dest)
+        program.append( ("push",) ) # store current data
+        if colorname:
+            program.append( ("color", colorname) )
+        program.append( ('lineOperation', Link) )
+        if colorname:
+            program.append( ('lineOperation', UNDERLINE) )
+        for e in content:
+            self.compileComponent(e, program)
+        if colorname:
+            program.append( ('endLineOperation', UNDERLINE) )
+        program.append( ('endLineOperation', Link) )
+        program.append( ("pop",) ) # restore as before
+
+    #def compile_p(self, attdict, content, extra, program):
+    #    # have to be careful about base indent here!
+    #    not finished
+
+    def compile_bullet(self, attdict, content, extra, program):
+        ### eventually should allow things like images and graphics in bullets too XXXX
+        if len(content)!=1 or type(content[0]) not in (StringType, UnicodeType):
+            raise ValueError, "content for bullet must be a single string"
+        text = content[0]
+        self.do_bullet(text, program)
+
+    def do_bullet(self, text, program):
+        style = self.style1
+        #program = self.program
+        indent = style.bulletIndent + self.baseindent
+        font = style.bulletFontName
+        size = style.bulletFontSize
+        program.append( ("bullet", text, indent, font, size) )
+
+    def compile_tt(self, attdict, content, extra, program):
+        (f,b,i) = self.shiftfont(program, face="Courier")
+        for e in content:
+            self.compileComponent(e, program)
+        self.shiftfont(program, face=f)
+
+    def compile_greek(self, attdict, content, extra, program):
+        self.compile_font({"face": "symbol"}, content, extra, program)
+
+    def compile_name(self, attdict, content, extra, program):
+        program.append( NameObject(attdict, content, extra, self.context) )
+
+    def compile_getname(self, attdict, content, extra, program):
+        program.append( GetNameObject(attdict, content, extra, self.context) )
+
+    def compile_seq(self, attdict, content, extra, program):
+        program.append( SeqObject(attdict, content, extra, self.context) )
+
+    def compile_seqreset(self, attdict, content, extra, program):
+        program.append( SeqResetObject(attdict, content, extra, self.context) )
+
+    def compile_seqdefault(self, attdict, content, extra, program):
+        program.append( SeqDefaultObject(attdict, content, extra, self.context) )
+
+    def compile_para(self, attdict, content, extra, program, stylename = "para.defaultStyle"):
+        if attdict is None:
+            attdict = {}
+        context = self.context
+        stylename = attdict.get("style", stylename)
+        style = context[stylename]
+        newstyle = SimpleStyle(name="rml2pdf internal embedded style", parent=style)
+        newstyle.addAttributes(attdict)
+        bulletText = attdict.get("bulletText", None)
+        mystyle = self.style1
+        thepara = Para(newstyle, content, context=context, bulletText=bulletText)
+        # possible ref loop on context, break later
+        # now compile it and add it to the program
+        mybaseindent = self.baseindent
+        self.baseindent = thepara.baseindent = mystyle.leftIndent + self.baseindent
+        thepara.linearize(program=program)
+        program.append( ("nextLine", 0) )
+        self.baseindent = mybaseindent
+
+
+    # XXX temporary declarations (STX-Parser procudes prefmt inside para currently)
+    compile_prefmt = compile_para
+
+
+    
+
+class bulletMaker:
+    def __init__(self, tagname, atts, context):
+        self.tagname = tagname
+        #print "context is", context
+        style = "li.defaultStyle"
+        self.style = style = atts.get("style", style)
+        typ = {"ul": "disc", "ol": "1", "dl": None}[tagname]
+        #print tagname, "bulletmaker type is", typ
+        self.typ =typ = atts.get("type", typ)
+        #print tagname, "bulletmaker type is", typ
+        if not atts.has_key("leftIndent"):
+            # get the style so you can choose an indent length
+            thestyle = context[style]
+            from reportlab.pdfbase.pdfmetrics import stringWidth
+            size = thestyle.fontSize
+            indent = stringWidth("XXX", "Courier", size)
+            atts["leftIndent"] = str(indent)
+        self.count = 0
+
+    def makeBullet(self, atts, bl=None):
+        count = self.count = self.count+1
+        typ = self.typ
+        tagname = self.tagname
+        #print "makeBullet", tagname, typ, count
+        # forget space before for non-first elements
+        if count>1:
+            atts["spaceBefore"] = "0"
+        if bl is None:
+            if tagname=="ul":
+                if typ=="disc": bl = chr(109)
+                elif typ=="circle": bl = chr(108)
+                elif typ=="square": bl = chr(110)
+                else:
+                    raise ValueError, "unordered list type %s not implemented" % repr(typ)
+                if not atts.has_key("bulletFontName"):
+                    atts["bulletFontName"] = "ZapfDingbats"
+            elif tagname=="ol":
+                if typ=="1": bl = repr(count)
+                elif typ=="a":
+                    theord = ord("a")+count-1
+                    bl = chr(theord)
+                elif typ=="A":
+                    theord = ord("A")+count-1
+                    bl = chr(theord)
+                else:
+                    raise ValueError, "ordered bullet type %s not implemented" % repr(typ)
+                # XXX Add a dot after the bullet
+                bl += '.'
+            else:
+                raise ValueError, "bad tagname "+repr(tagname)
+        if not atts.has_key("bulletText"):
+            atts["bulletText"] = bl
+        if not atts.has_key("style"):
+            atts["style"] = self.style
+
+class EvalStringObject:
+    "this will only work if rml2pdf is present"
+
+    tagname = "evalString"
+
+    def __init__(self, attdict, content, extra, context):
+        if not attdict:
+            attdict = {}
+        self.attdict = attdict
+        self.content = content
+        self.context = context
+        self.extra = extra
+
+    def getOp(self, tuple, engine):
+        from rlextra.rml2pdf.rml2pdf import Controller
+        #print "tuple", tuple
+        op = self.op = Controller.processTuple(tuple, self.context, {})
+        return op
+
+    def width(self, engine):
+        from reportlab.pdfbase.pdfmetrics import stringWidth
+        content = self.content
+        if not content:
+            content = []
+        tuple = (self.tagname, self.attdict, content, self.extra)
+        op = self.op = self.getOp(tuple, engine)
+        #print op.__class__
+        #print op.pcontent
+        #print self
+        s = str(op)
+        return stringWidth(s, engine.fontName, engine.fontSize)
+
+    def execute(self, engine, textobject, canvas):
+        textobject.textOut(str(self.op))
+
+
+class SeqObject(EvalStringObject):
+
+    def getOp(self, tuple, engine):
+        from reportlab.lib.sequencer import getSequencer
+        globalsequencer = getSequencer()
+        attr = self.attdict
+        #if it has a template, use that; otherwise try for id;
+        #otherwise take default sequence
+        if attr.has_key('template'):
+            templ = attr['template']
+            op = self.op = templ % globalsequencer
+            return op
+        elif attr.has_key('id'):
+            id = attr['id']
+        else:
+            id = None
+        op = self.op = globalsequencer.nextf(id)
+        return op
+
+class NameObject(EvalStringObject):
+    tagname = "name"
+    def execute(self, engine, textobject, canvas):
+        pass # name doesn't produce any output
+
+class SeqDefaultObject(NameObject):
+
+    def getOp(self, tuple, engine):
+        from reportlab.lib.sequencer import getSequencer
+        globalsequencer = getSequencer()
+        attr = self.attdict
+        try:
+            default = attr['id']
+        except KeyError:
+            default = None
+        globalsequencer.setDefaultCounter(default)
+        self.op = ""
+        return ""
+
+class SeqResetObject(NameObject):
+
+    def getOp(self, tuple, engine):
+        from reportlab.lib.sequencer import getSequencer
+        import math
+        globalsequencer = getSequencer()
+        attr = self.attdict
+        try:
+            id = attr['id']
+        except KeyError:
+            id = None
+        try:
+            base = math.atoi(attr['base'])
+        except:
+            base=0
+        globalsequencer.reset(id, base)
+        self.op = ""
+        return ""
+
+class GetNameObject(EvalStringObject):
+    tagname = "getName"
+
+
+class PageNumberObject:
+
+    def __init__(self, example="XXX"):
+        self.example = example # XXX SHOULD ADD THE ABILITY TO PASS IN EXAMPLES
+
+    def width(self, engine):
+        from reportlab.pdfbase.pdfmetrics import stringWidth
+        return stringWidth(self.example, engine.fontName, engine.fontSize)
+
+    def execute(self, engine, textobject, canvas):
+        n = canvas.getPageNumber()
+        textobject.textOut(str(n))
+
+
+
+testparagraph = """
+This is Text.
+<b>This is bold text.</b>
+This is Text.
+<i>This is italic text.</i>
+
+<ul>
+    <li> this is an element at 1
+more text and even more text and on and on and so forth
+more text and even more text and on and on and so forth
+more text and even more text and on and on and so forth
+more text and even more text and on and on and so forth
+more text and even more text and on and on and so forth
+more text <tt>monospaced</tt> and back to normal
+
+    <ul>
+        <li> this is an element at 2
+
+more text and even more text and on and on and so forth
+more text and even more text and on and on and so forth
+
+        <ul>
+            <li> this is an element at 3
+
+more text and even more text and on and on and so forth
+
+
+                <dl bulletFontName="Helvetica-BoldOblique" spaceBefore="10" spaceAfter="10">
+                <dt>frogs</dt> <dd>Little green slimy things. Delicious with <b>garlic</b></dd>
+                <dt>kittens</dt> <dd>cute, furry, not edible</dd>
+                <dt>bunnies</dt> <dd>cute, furry,. Delicious with <b>garlic</b></dd>
+                </dl>
+
+more text and even more text and on and on and so forth
+
+            <ul>
+                <li> this is an element at 4
+
+more text and even more text and on and on and so forth
+more text and even more text and on and on and so forth
+
+                </li>
+            </ul>
+
+more text and even more text and on and on and so forth
+more text and even more text and on and on and so forth
+
+            </li>
+        </ul>
+more text and even more text and on and on and so forth
+more text and even more text and on and on and so forth
+
+        </li>
+
+    </ul>
+<u><b>UNDERLINED</b> more text and even more text and on and on and so forth
+more text and even more text and on and on and so forth</u>
+
+<ol type="a">
+    <li>first element of the alpha list
+
+     <ul type="square">
+        <li>first element of the square unnumberred list</li>
+
+        <li>second element of the unnumberred list</li>
+
+        <li>third element of the unnumberred list
+        third element of the unnumberred list
+        third element of the unnumberred list
+        third element of the unnumberred list
+        third element of the unnumberred list
+        third element of the unnumberred list
+        third element of the unnumberred list
+        </li>
+
+        <li>fourth element of the unnumberred list</li>
+
+      </ul>
+
+    </li>
+
+    <li>second element of the alpha list</li>
+
+    <li>third element of the alpha list
+    third element of the unnumberred list &amp;#33; --> &#33;
+    third element of the unnumberred list &amp;#8704; --> &#8704;
+    third element of the unnumberred list &amp;exist; --> &exist;
+    third element of the unnumberred list
+    third element of the unnumberred list
+    third element of the unnumberred list
+    </li>
+
+    <li>fourth element of the alpha list</li>
+
+  </ol>
+
+
+    </li>
+</ul>
+
+<a href="http://www.reportlab.com">goto www.reportlab.com</a>.
+
+
+<para alignment="justify">
+<font color="red" size="15">R</font>ed letter. thisisareallylongword andsoisthis andthisislonger
+justified text paragraph example
+justified text paragraph example
+justified text paragraph example
+</para>
+
+"""
+
+def test2(canv):
+    #print test_program; return
+    from reportlab.lib.units import inch
+    from reportlab.lib.styles import ParagraphStyle
+    from reportlab.lib import rparsexml
+    parsedpara = rparsexml.parsexmlSimple(testparagraph,entityReplacer=None)
+    S = ParagraphStyle("Normal", None)
+    P = Para(S, parsedpara)
+    (w, h) = P.wrap(5*inch, 10*inch)
+    print "wrapped as", (h,w)
+    canv.translate(1*inch, 1*inch)
+    canv.rect(0,0,5*inch,10*inch, fill=0, stroke=1)
+    P.canv = canv
+    P.draw()
+    canv.setStrokeColorRGB(1, 0, 0)
+    #canv.translate(0, 3*inch)
+    canv.rect(0,0,w,-h, fill=0, stroke=1)
+
+def handleSpecialCharacters(engine, text, program=None):
+    from reportlab.platypus.paraparser import greeks, symenc
+    from string import whitespace, atoi, atoi_error
+    standard={'lt':'<', 'gt':'>', 'amp':'&', 'quot':'"'}
+    # add space prefix if space here
+    if text[0:1] in whitespace:
+        program.append(" ")
+    #print "handling", repr(text)
+    # shortcut
+    if 0 and "&" not in text:
+        result = []
+        for x in text.split():
+            result.append(x+" ")
+        if result:
+            last = result[-1]
+            if text[-1:] not in whitespace:
+                result[-1] = last.strip()
+        program.extend(result)
+        return program
+    if program is None:
+        program = []
+    amptext = text.split("&")
+    first = 1
+    lastfrag = amptext[-1]
+    for fragment in amptext:
+        if not first:
+            # check for special chars
+            semi = fragment.find(";")
+            if semi>0:
+                name = fragment[:semi]
+                if name[0]=='#':
+                    try:
+                        if name[1] == 'x':
+                            n = atoi(name[2:], 16)
+                        else:
+                            n = atoi(name[1:])
+                    except atoi_error:
+                        n = -1
+                    if 0<=n<=255: fragment = chr(n)+fragment[semi+1:] 
+                    elif symenc.has_key(n):
+                        fragment = fragment[semi+1:]
+                        (f,b,i) = engine.shiftfont(program, face="symbol")
+                        program.append(symenc[n])
+                        engine.shiftfont(program, face=f)
+                        if fragment and fragment[0] in whitespace:
+                            program.append(" ") # follow with a space
+                    else:
+                        fragment = "&"+fragment
+                elif standard.has_key(name):
+                    fragment = standard[name]+fragment[semi+1:]
+                elif greeks.has_key(name):
+                    fragment = fragment[semi+1:]
+                    greeksub = greeks[name]
+                    (f,b,i) = engine.shiftfont(program, face="symbol")
+                    program.append(greeksub)
+                    engine.shiftfont(program, face=f)
+                    if fragment and fragment[0] in whitespace:
+                        program.append(" ") # follow with a space
+                else:
+                    # add back the &
+                    fragment = "&"+fragment
+            else:
+                # add back the &
+                fragment = "&"+fragment
+        # add white separated components of fragment followed by space
+        sfragment = fragment.split()
+        for w in sfragment[:-1]:
+            program.append(w+" ")
+        # does the last one need a space?
+        if sfragment and fragment:
+            # reader 3 used to go nuts if you don't special case the last frag, but it's fixed?
+            if fragment[-1] in whitespace: # or fragment==lastfrag:
+                program.append( sfragment[-1]+" " )
+            else:
+                last = sfragment[-1].strip()
+                if last:
+                    #print "last is", repr(last)
+                    program.append( last )
+        first = 0
+    #print "HANDLED", program
+    return program
+
+def Paragraph(text, style, bulletText=None, frags=None, context=None):
+    """ Paragraph(text, style, bulletText=None)
+    intended to be like a platypus Paragraph but better.
+    """
+    # if there is no & or < in text then use the fast paragraph
+    #if "&" not in text and "<" not in text:
+    #    return FastPara(style, simpletext=text)
+    #else:
+    # use the fully featured one.
+    from reportlab.lib import rparsexml
+    parsedpara = rparsexml.parsexmlSimple(text,entityReplacer=None)
+    return Para(style, parsedText=parsedpara, bulletText=bulletText, state=None, context=context)
+
+class UnderLineHandler:
+    def __init__(self, color=None):
+        self.color = color
+    def start_at(self, x,y, para, canvas, textobject):
+        self.xStart = x
+        self.yStart = y
+    def end_at(self, x, y, para, canvas, textobject):
+        offset = para.fontSize/8.0
+        canvas.saveState()
+        color = self.color
+        if self.color is None:
+            color = para.fontColor
+        canvas.setStrokeColor(color)
+        canvas.line(self.xStart, self.yStart-offset, x,y-offset)
+        canvas.restoreState()
+
+UNDERLINE = UnderLineHandler()
+
+class HotLink(UnderLineHandler):
+
+    def __init__(self, url):
+        self.url = url
+
+    def end_at(self, x, y, para, canvas, textobject):
+        fontsize = para.fontSize
+        rect = [self.xStart, self.yStart, x,y+fontsize]
+        if debug:
+            print "LINKING RECTANGLE", rect
+            #canvas.rect(self.xStart, self.yStart, x-self.xStart,y+fontsize-self.yStart, stroke=1)
+        self.link(rect, canvas)
+
+    def link(self, rect, canvas):
+        canvas.linkURL(self.url, rect, relative=1)
+
+class InternalLink(HotLink):
+
+    def link(self, rect, canvas):
+        destinationname = self.url
+        contents = ""
+        canvas.linkRect(contents, destinationname, rect, Border="[0 0 0]")
+
+class DefDestination(HotLink):
+
+    defined = 0
+
+    def link(self, rect, canvas):
+        destinationname = self.url
+        if not self.defined:
+            [x, y, x1, y1] = rect
+            canvas.bookmarkHorizontal(destinationname, x, y1) # use the upper y
+            self.defined = 1
+
+def splitspace(text):
+    # split on spacing but include spaces at element ends
+    stext = text.split()
+    result = []
+    for e in stext:
+        result.append(e+" ")
+    return result
+
+testlink = HotLink("http://www.reportlab.com")
+
+test_program = [
+    ('push',),
+    ('indent', 100),
+                    ('rightIndent', 200),
+                    ('bullet', 'very long bullet', 50, 'Courier', 14),
+                    ('align', TA_CENTER),
+                    ('face', "Times-Roman"),
+                    ('size', 12),
+                    ('leading', 14),
+                    ] + splitspace("This is the first segment of the first paragraph.") + [
+                    ('lineOperation', testlink),
+                    ]+splitspace("HOTLINK This is the first segment of the first paragraph. This is the first segment of the first paragraph. This is the first segment of the first paragraph. This is the first segment of the first paragraph. ") + [
+                    ('endLineOperation', testlink),
+                    ('nextLine', 0),
+                    ('align', TA_LEFT),
+                    ('bullet', 'Bullet', 10, 'Courier', 8),
+                    ('face', "Times-Roman"),
+                    ('size', 12),
+                    ('leading', 14),
+                    ] + splitspace("This is the SECOND!!! segment of the first paragraph. This is the first segment of the first paragraph. This is the first segment of the first paragraph. This is the first segment of the first paragraph. This is the first segment of the first paragraph. ") + [
+                    ('nextLine', 0),
+                    ('align', TA_JUSTIFY),
+                    ('bullet', 'Bullet not quite as long this time', 50, 'Courier', 8),
+                    ('face', "Helvetica-Oblique"),
+                    ('size', 12),
+                    ('leading', 14),
+                    ('push',),
+                    ('color', 'red'),
+                    ] + splitspace("This is the THIRD!!! segment of the first paragraph."
+                                     ) + [
+                    ('lineOperation', UNDERLINE),
+                    ] + splitspace("This is the first segment of the first paragraph. This is the first segment of the first paragraph. This is the first segment of the first paragraph. This is the first segment of the first paragraph. ") + [
+                    ('endLineOperation', UNDERLINE),
+                    ('rise', 5),
+                    "raised ", "text ",
+                    ('rise', -10),
+                    "lowered ", "text ",
+                    ('rise', 5),
+                    "normal ", "text ",
+                    ('pop',),
+                    ('indent', 100),
+                    ('rightIndent', 50),
+                    ('nextLine', 0),
+                    ('align', TA_RIGHT),
+                    ('bullet', 'O', 50, 'Courier', 14),
+                    ('face', "Helvetica"),
+                    ('size', 12),
+                    ('leading', 14),
+                    ] + splitspace("And this is the remainder of the paragraph indented further. a a a a a a a a And this is the remainder of the paragraph indented further. a a a a a a a a And this is the remainder of the paragraph indented further. a a a a a a a a And this is the remainder of the paragraph indented further. a a a a a a a a And this is the remainder of the paragraph indented further. a a a a a a a a And this is the remainder of the paragraph indented further. a a a a a a a a And this is the remainder of the paragraph indented further. a a a a a a a a ") + [
+            ('pop',),
+            ('nextLine', 0),]
+
+
+def test():
+    from pprint import pprint
+    #print test_program; return
+    from reportlab.pdfgen import canvas
+    from reportlab.lib.units import inch
+    fn = "paratest0.pdf"
+    c = canvas.Canvas(fn)
+    test2(c)
+    c.showPage()
+    if 1:
+        remainder = test_program + test_program + test_program
+        laststate = {}
+        while remainder:
+            print "NEW PAGE"
+            c.translate(inch, 8*inch)
+            t = c.beginText()
+            t.setTextOrigin(0,0)
+            p = paragraphEngine()
+            p.resetState(laststate)
+            p.x = 0
+            p.y = 0
+            maxwidth = 7*inch
+            maxheight = 500
+            (formattedprogram, remainder, laststate, height) = p.format(maxwidth, maxheight, remainder)
+            if debug:
+                pprint( formattedprogram )#; return
+            laststate = p.runOpCodes(formattedprogram, c, t)
+            c.drawText(t)
+            c.showPage()
+            print "="*30, "x=", laststate["x"], "y=", laststate["y"]
+    c.save()
+    print fn
+
+if __name__=="__main__":
+    test()


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Paragraph.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Parser.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Parser.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Parser.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,751 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   CMFReportTool - Generating PDF-Skins on the Fly from CMF-Sites
+#
+#   Copyright (C) 2002  net-labs Systemhaus GmbH
+#                                               info at net-labs.de
+#
+#   This library is free software; you can redistribute it and/or
+#   modify it under the terms of the GNU Lesser General Public
+#   License as published by the Free Software Foundation; either
+#   version 2.1 of the License, or (at your option) any later version.
+#
+#   This library 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
+#   Lesser General Public License for more details.
+#
+#   You should have received a copy of the GNU Lesser General Public
+#   License along with this library; if not, write to the Free Software
+#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+###############################################################################
+"""Portal forms __init__.
+$Id$
+"""
+__version__='$Revision: 1.17 $'[11:-2]
+
+import string
+import imp
+
+from types import ListType, DictType, UnicodeType
+
+from reportlab.lib import colors
+from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
+from reportlab.lib.units import toLength
+try:
+    from reportlab.lib.utils import PIL_Image
+except ImportError:
+    PIL_Image = None
+
+if not PIL_Image:
+    try:
+        # reportlab 1.19 compatibility
+        from reportlab.lib.utils import Image as PIL_Image
+    except ImportError:
+        from PIL import Image as PIL_Image
+        
+import Platypus
+
+
+graphic_objects = ['fixedimage', 'rectangle', 'roundrect',
+                   'ellipse', 'polygon', 'line',
+                   'string', 'infostring', 'customshape']
+
+content_objects = ['para', 'prefmt', 'image', 'spacer']
+
+alignment_enum = {'left': TA_LEFT,
+                  'right':TA_RIGHT,
+                  'center':TA_CENTER,
+                  'justify':TA_JUSTIFY,
+                  }
+
+
+parameter_conversion = {'int':    string.atoi,
+                        'float':  string.atof,
+                        'string': str,
+                        'unit':   toLength,
+                        'color':  colors.toColor,
+                        'alignment': alignment_enum.get,
+                        }
+
+
+
+_marker = None
+
+def findAttrName(names, name):
+    ret = None
+    if name in names:
+        ret = name
+    lname = name.lower()
+    for n,ln in [(n,n.lower()) for n in names]:
+        if ln == lname:
+            ret = n
+            break
+    return ret
+    
+
+
+
+def unescape(s):
+    if '&' not in s:
+        return s
+    s = s.replace("&lt;", "<")
+    s = s.replace("&gt;", ">")
+    s = s.replace("&apos;", "'")
+    s = s.replace("&quot;", '"')
+    s = s.replace("&amp;", "&") # Must be last
+    return s
+
+
+
+class NullResourceHandler:
+    ''' basic resource Handler '''
+    
+    def __init__(self):
+        pass
+        
+    def get(self,url):
+        return url
+
+
+class Parser:
+    ''' base class'''
+    
+    xml_attributes = {}
+
+    def __init__(self,dom,encoding,resourceHandler=None):
+        self.dom = dom
+        self.encoding = encoding
+        self.resourceHandler = resourceHandler or NullResourceHandler()
+
+    def xml_arg(self, node, name):
+        if name in node.attributes.keys():
+            v = node.getAttribute(name)
+        else:
+            if self.xml_attributes.has_key(node.nodeName):
+                v = self.xml_attributes[node.nodeName][name]
+            else:
+                v = None
+                
+        if type(v) == UnicodeType:
+            v = v.encode(self.encoding)
+        return v
+
+    def xml_ceval(self,node,name):
+        if name in node.attributes.keys():
+            v = node.getAttribute(name)
+        else:
+            if self.xml_attributes.has_key(node.nodeName):
+                v = self.xml_attributes[node.nodeName][name]
+            else:
+                return None
+
+        if type(v) == UnicodeType:
+            v = v.encode(self.encoding)
+        return eval(v)
+        
+    def xml_unit(self,node,name):
+        val = self.xml_arg(node,name)
+        # XXX how can val be None ??
+        if val is None:
+            return 0
+        if val == 'None':
+            return None
+        return toLength(val)
+
+    def xml_data(self,node):
+        str_data = u''
+        for clds in node.childNodes:
+            if clds.nodeType == 3:
+                str_data += clds.data
+        return str_data.encode(self.encoding)
+
+    def xml_data_list(self,node):
+        list_data = []
+        for clds in node.childNodes:
+            if clds.nodeType == 3:
+                v = clds.data
+                if type(v) == UnicodeType:
+                    v = v.encode(self.encoding)
+                list_data.append(v)
+        return list_data
+
+    def __call__(self):
+        doc = self._create()
+        return doc.create()
+
+    def _createObject(self,node):
+        pass
+        
+    def _create(self):
+        pass
+            
+
+
+
+class TemplateParser(Parser):
+    ''' parses a template file'''
+    
+    xml_attributes = {'template': {
+                'filename':'out.pdf',
+                'pagesize':'A4',
+                'landscape':'0',
+                'showboundary':'0',
+                'leftmargin':'0',  #this is ignored
+                'topmargin':'0',  #this is ignored
+                'rightmargin':'0',  #this is ignored
+                'bottommargin':'0',  #this is ignored
+                'allowsplitting':'1',
+                    },
+             'frame': {
+                'x':'0',
+                'y':'0',
+                'width':'0',
+                'height':'0',
+                'showboundary':'0',
+                'leftpadding':'0',  #this is ignored
+                'toppadding':'0',  #this is ignored
+                'rightpadding':'0',  #this is ignored
+                'bottompadding':'0',  #this is ignored
+                },
+              
+            'stylesheet': {
+                'path':'None',
+                'module':'None',
+                'function':'getParagraphStyles'
+                },
+            'rectangle': {
+                'x':'0',
+                'y':'0',
+                'width':'100',
+                'height':'100',
+                'fill':'None',
+                'stroke':'(0,0,0)',
+                'linewidth':'0'
+                },
+            'roundrect': {
+                'x':'0',
+                'y':'0',
+                'width':'100',
+                'height':'100',
+                'radius':'6',
+                'fill':'None',
+                'stroke':'(0,0,0)',
+                'linewidth':'0'
+
+                },
+            'line': {
+                'x1':'0',
+                'y1':'0',
+                'x2':'100',
+                'y2':'100',
+                'stroke':'(0,0,0)',
+                'width':'0'
+
+                },
+            'ellipse': {
+                'x1':'0',
+                'y1':'0',
+                'x2':'100',
+                'y2':'100',
+                'stroke':'(0,0,0)',
+                'fill':'None',
+                'linewidth':'0'
+
+                },
+            'polygon': {
+                'points':'(0,0),(50,0),(25,25)',
+                'stroke':'(0,0,0)',
+                'linewidth':'0',
+                'stroke':'(0,0,0)',
+                'fill':'None'
+
+                },
+            'string':{
+                'x':'0',
+                'y':'0',
+                'color':'(0,0,0)',
+                'font':'Times-Roman',
+                'size':'12',
+                'align':'left'
+                },
+            'infostring':{
+                'x':'0',
+                'y':'0',
+                'color':'(0,0,0)',
+                'font':'Times-Roman',
+                'size':'12',
+                'align':'left'
+                },
+            'customshape':{
+                'path':'None',
+                'module':'None',
+                'class':'None',
+                'initargs':'None'
+                }
+    
+             }
+
+
+    def _createObject(self,node):
+        rhandler = self.resourceHandler
+        obj = None
+        if node.nodeName == 'template':
+            obj = Platypus.xmlTemplate()
+            obj.filename = self.xml_arg(node,'filename')
+            obj.pagesize = self.xml_arg(node,'pagesize')
+            obj.landscape = self.xml_ceval(node,'landscape')
+            obj.showboundary = self.xml_ceval(node,'showboundary')
+            obj.leftmargin = self.xml_unit(node,'leftmargin')
+            obj.rightmargin = self.xml_unit(node,'rightmargin')
+            obj.topmargin = self.xml_unit(node,'topmargin')
+            obj.bottommargin = self.xml_unit(node,'bottommargin')
+            obj.allowsplitting = self.xml_ceval(node,'allowsplitting')
+
+        elif node.nodeName == 'pagetemplate':
+            obj = Platypus.xmlPageTemplate(
+                self.xml_arg(node,'id'),self.xml_arg(node,'nextid'))
+            obj.startframe = self.xml_arg(node,'startframe')
+
+        elif node.nodeName == 'frame':
+            obj = Platypus.xmlFrame(
+                self.xml_arg(node,'id'),
+                self.xml_arg(node,'nextid'),
+                self.xml_unit(node,'x'),
+                self.xml_unit(node,'y'),
+                self.xml_unit(node,'width'),
+                self.xml_unit(node,'height')
+                )
+            obj.showboundary = self.xml_unit(node,'showboundary')
+            obj.leftpadding = self.xml_unit(node,'leftpadding')
+            obj.rightpadding = self.xml_unit(node,'rightpadding')
+            obj.toppadding = self.xml_unit(node,'toppadding')
+            obj.bottompadding = self.xml_unit(node,'bottompadding')
+
+        elif node.nodeName == 'fixedimage':
+            obj = Platypus.xmlFixedImage()
+            obj.filename = PIL_Image.open(
+                rhandler.get(self.xml_arg(node,'filename')))
+            obj.x = self.xml_unit(node,'x')
+            obj.y = self.xml_unit(node,'y')
+            obj.width = self.xml_unit(node,'width')
+            obj.height = self.xml_unit(node,'height')
+
+        elif node.nodeName == 'rectangle':
+            obj = Platypus.xmlRectangle(
+                self.xml_unit(node,'x'),
+                self.xml_unit(node,'y'),
+                self.xml_unit(node,'width'),
+                self.xml_unit(node,'height')
+                )
+            obj.fillColor = self.xml_ceval(node,'fill')
+            obj.strokeColor = self.xml_ceval(node,'stroke')
+            obj.lineWidth = self.xml_unit(node,'linewidth')
+
+        elif node.nodeName == 'roundrect':
+            obj = Platypus.xmlRoundRect(
+                self.xml_unit(node,'x'),
+                self.xml_unit(node,'y'),
+                self.xml_unit(node,'width'),
+                self.xml_unit(node,'height'),
+                self.xml_unit(node,'radius')
+                )
+            obj.fillColor = self.xml_ceval(node,'fill')
+            obj.strokeColor = self.xml_ceval(node,'stroke')
+            obj.lineWidth = self.xml_unit(node,'linewidth')
+
+        elif node.nodeName == 'line':
+            obj = Platypus.xmlLine(
+                self.xml_unit(node,'x1'),
+                self.xml_unit(node,'y1'),
+                self.xml_unit(node,'x2'),
+                self.xml_unit(node,'y2')
+                )
+            obj.strokeColor = self.xml_ceval(node,'stroke')
+            obj.lineWidth = self.xml_unit(node,'width')
+
+        elif node.nodeName == 'ellipse':
+            obj = Platypus.xmlEllipse(
+                self.xml_unit(node,'x1'),
+                self.xml_unit(node,'y1'),
+                self.xml_unit(node,'x2'),
+                self.xml_unit(node,'y2')
+                )
+            obj.fillColor = self.xml_ceval(node,'fill')
+            obj.strokeColor = self.xml_ceval(node,'stroke')
+            obj.lineWidth = self.xml_unit(node,'linewidth')
+
+        elif node.nodeName == 'polygon':
+            obj = Platypus.xmlPolygon(self.xml_ceval(node,'points'))
+            obj.fillColor = self.xml_ceval(node,'fill')
+            obj.strokeColor = self.xml_ceval(node,'stroke')
+            obj.lineWidth = self.xml_unit(node,'linewidth')
+
+        elif node.nodeName == 'string':
+            obj = Platypus.xmlString(
+                self.xml_unit(node,'x'),
+                self.xml_unit(node,'y')
+                )
+            obj.color = self.xml_ceval(node,'color')
+            obj.font = self.xml_arg(node,'font')
+            obj.size = self.xml_ceval(node,'size')
+            
+            obj.align = alignment_enum.get(self.xml_arg(node,'align'))
+            obj.text = self.xml_data(node)
+            
+        elif node.nodeName == 'infostring':
+            obj = Platypus.xmlString(
+                self.xml_unit(node,'x'),
+                self.xml_unit(node,'y')
+                )
+            obj.color = self.xml_ceval(node,'color')
+            obj.font = self.xml_arg(node,'font')
+            obj.size = self.xml_ceval(node,'size')
+            
+            obj.align = alignment_enum.get(self.xml_arg(node,'align'))
+            obj.text = self.xml_data(node)
+            obj.hasInfo = 1
+
+        elif node.nodeName == 'paragraphstyle':
+            name = self.xml_arg(node, 'name')
+            parent = None
+            if 'parent' in node.attributes.keys():
+                parent = self.xml_arg(node,'parent')
+            obj = Platypus.xmlParagraphStyle(name, parent)
+
+            names_dict = dict(
+                [(n.lower(), n) for n in node.attributes.keys()])
+            
+            for name, conv in [
+                ('fontName', self.xml_arg),
+                ('fontSize', self.xml_ceval),
+                ('leading', self.xml_unit),
+                ('leftIndent', self.xml_unit),
+                ('rightIndent', self.xml_unit),
+                ('firstLineIndent', self.xml_unit),
+                ('alignment',
+                     lambda no, na: alignment_enum.get(self.xml_arg(no, na)) ),
+                ('spaceBefore', self.xml_unit),
+                ('spaceAfter', self.xml_unit),
+                ('bulletFontName', self.xml_arg),
+                ('bulletFontSize', self.xml_ceval),
+                ('bulletIndent', self.xml_unit),
+                ('textColor',
+                     lambda no, na: colors.toColor(self.xml_arg(no, na)) ),
+                ]:
+
+                lowered = name.lower()
+                if lowered in names_dict.keys():
+                    value = conv(node, name)
+                    if value is not None:
+                        obj.attributes[names_dict[lowered]] = conv(node, name)
+
+        elif node.nodeName == 'tablestyle':
+            name = self.xml_arg(node,'name')
+            obj = Platypus.xmlTableStyle(name)
+            
+        elif node.nodeName == 'stylecmd':
+            obj = self.xml_ceval(node,'expr')
+            
+        elif node.nodeName == 'customshape':
+            # XXX Potential Security problem !!!!!!
+            # we cannot use the mechanism from PageTemplates/PythonScripts here,
+            # without making RenderPDF dependent on Zope2 :(((((
+            path = self.xml_arg(node,'path')
+            if path=='None':
+                path = None
+            else:
+                path=[path]
+            modulename = self.xml_arg(node,'module')
+            funcname = self.xml_arg(node,'class')
+            found = imp.find_module(modulename, path)
+            assert found, "CustomShape %s not found" % modulename
+            (file, pathname, description) = found
+            mod = imp.load_module(modulename, file, pathname, description)
+
+            #now get the function
+
+            func = getattr(mod, funcname)
+            initargs = self.xml_ceval(node,'initargs')
+            obj = apply(func, initargs)
+        
+        else:
+            raise AttributeError, "Unknown NodeName: %s" % node.nodeName
+            
+        return obj
+    
+    def _create(self):
+        
+        nodesRoot = self.dom.firstChild
+        current_obj = self._createObject(nodesRoot)
+        obj = current_obj
+        
+        for nodesL1 in nodesRoot.childNodes:
+            if nodesL1.nodeName == 'pagetemplate':
+                current_obj = self._createObject(nodesL1)
+                obj.pagetemplates.append(current_obj)
+                for nodesL2 in nodesL1.childNodes:
+                    if nodesL2.nodeName == 'static':
+                        for nodesL3 in nodesL2.childNodes:
+                            if nodesL3.nodeName in graphic_objects:
+                                current_obj.graphics.append(self._createObject(nodesL3))
+                    elif nodesL2.nodeName == 'frame':
+                        frame = self._createObject(nodesL2)
+                        current_obj.frames.append(frame)
+            elif nodesL1.nodeName == 'stylesheet':
+                for nodesL2 in nodesL1.childNodes:
+                    if nodesL2.nodeName == 'paragraphstyle':
+                        current_obj = self._createObject(nodesL2)
+                        obj.stylesheet.append(current_obj)
+                    elif nodesL2.nodeName == 'tablestyle':
+                        current_obj = self._createObject(nodesL2)
+                        for nodesL3 in nodesL2.childNodes:
+                            if nodesL3.nodeName == 'stylecmd':
+                                current_obj.commands.append(self._createObject(nodesL3))
+                        obj.stylesheet.append(current_obj)
+        return obj
+            
+
+
+
+
+
+class DocumentParser(Parser):
+    ''' document parser class'''
+    
+    xml_attributes = {'document': {'filename':'None',
+                                   },
+                      'para': {'style':'Normal',
+                               'bullettext':''
+                               },
+                      'image': {'filename':'',
+                                'width':'None',
+                                'height':'None'
+                                },
+                      'table': {'rowheight':'0',
+                                'colwidth':'0',
+                                'splitbyrow':'1',
+                                'repeatrows':'1',
+                                'repeatcols':'0',
+                                'style':'None'
+                                },
+                      'tr' : {'rowheight':'0',
+                              'stylecmd':'None',
+                              },
+                      'td' : {'colwidth':'0',
+                              'stylecmd':'None',
+                              },
+                      'spacer': {'height':'24'
+                                 },
+                      }
+             
+    def _createObject(self,node):
+        rhandler = self.resourceHandler
+        obj = None
+        if node.nodeName == 'document':
+            obj = Platypus.xmlDocument()
+            obj.filename = self.xml_arg(node,'filename')
+
+        elif node.nodeName == 'para':
+            obj = Platypus.xmlParagraph()
+            obj.style = self.xml_arg(node,'style')
+            obj.bulletText = self.xml_arg(node,'bullettext')
+            text = ''
+            for n in node.childNodes:
+                text += n.toxml()
+            if type(text) == UnicodeType:
+                text = text.encode(self.encoding)
+            obj.rawtext = text
+        
+        elif node.nodeName == 'prefmt':
+            obj = Platypus.xmlPreformattedText()
+            obj.style = self.xml_arg(node,'style')
+            obj.dedent = int(self.xml_arg(node,'dedent') or 0)
+            text = ''
+            for n in node.childNodes:
+                text = text + n.toxml()
+            if type(text) == UnicodeType:
+                text = text.encode(self.encoding)
+            obj.rawtext = unescape(text)
+        
+        elif node.nodeName == 'xprefmt':
+            obj = Platypus.xmlXPreformattedText()
+            obj.style = self.xml_arg(node,'style')
+            obj.dedent = int(self.xml_arg(node,'dedent') or 0)
+            text = ''
+            for n in node.childNodes:
+                text = text + n.toxml()
+            if type(text) == UnicodeType:
+                text = text.encode(self.encoding)
+            obj.rawtext = unescape(text)
+        
+        elif node.nodeName == 'image':
+            obj = Platypus.xmlImage()
+            obj.filename = rhandler.get(self.xml_arg(node,'filename'))
+            obj.width = self.xml_unit(node,'width')
+            obj.height = self.xml_unit(node,'height')
+        
+        elif node.nodeName == 'table':
+            obj = Platypus.xmlTable()
+            obj.table = Platypus.xTable()
+            obj.rowheight = self.xml_unit(node,'rowheight') or None
+            obj.colwidth = self.xml_unit(node,'colwidth') or None
+            obj.splitbyrow = self.xml_ceval(node,'splitbyrow')
+            obj.repeatrows = self.xml_ceval(node,'repeatrows')
+            obj.repeatcols = self.xml_ceval(node,'repeatcols')
+            if 'style' in node.attributes.keys():
+                obj.style = node.getAttribute('style')
+
+        elif node.nodeName == 'tr':
+            obj = Platypus.xRow()
+            obj.rowheight = self.xml_unit(node,'rowheight') or None
+            if 'stylecmd' in node.attributes.keys():
+                obj.stylecmd = self.xml_ceval(node,'stylecmd')
+
+        elif node.nodeName == 'td':
+            obj = Platypus.xCell()
+            obj.colwidth = self.xml_unit(node,'colwidth') or None
+            if 'stylecmd' in node.attributes.keys():
+                obj.stylecmd = self.xml_ceval(node,'stylecmd')
+
+        elif node.nodeName == 'spacer':
+            obj = Platypus.xmlSpacer()
+            obj.height = self.xml_ceval(node,'height')
+            
+        elif node.nodeName == 'action':
+            obj = Platypus.xmlAction()
+            obj.action = self.xml_arg(node,'name')
+            
+        elif node.nodeName == 'shape':
+            obj = Platypus.xmlShape()
+            obj.factory = self.xml_arg(node,'factory')
+            
+        elif node.nodeName == 'parameter':
+            typ  = self.xml_arg(node, 'type')
+            name = self.xml_arg(node, 'name')
+            data = self.xml_data(node)
+            if typ is not None and parameter_conversion.has_key(typ):
+                data = parameter_conversion[typ](data)
+                
+            if name is None:
+                obj = [data]
+            else:
+                obj = {name: data}
+        
+        elif node.nodeName in ['title','author','subject']:
+            obj = self.xml_data(node)
+        
+        else:
+            raise AttributeError, "Unknown NodeName: %s" % node.nodeName
+            
+        return obj
+
+    
+    
+    
+    
+    def _create(self, template=None):
+
+        stylesheet = template.getStyleSheet()
+        nodesRoot = self.dom.firstChild
+        current_obj = self._createObject(nodesRoot)
+        obj = current_obj
+        
+        for nodesL1 in nodesRoot.childNodes:
+            if nodesL1.nodeName == 'title':
+                obj.title = self._createObject(nodesL1)
+            elif nodesL1.nodeName == 'author':
+                obj.author = self._createObject(nodesL1)
+            elif nodesL1.nodeName == 'subject':
+                obj.subject = self._createObject(nodesL1)
+            elif nodesL1.nodeName == 'content':
+                for nodesL2 in nodesL1.childNodes:
+                    if nodesL2.nodeName in content_objects:
+                        current_obj = self._createObject(nodesL2)
+                        obj.content.append(current_obj)
+                    elif nodesL2.nodeName == 'table':
+                        current_obj = self._createObject(nodesL2)
+                        rows = []
+                        for nodesL3 in nodesL2.childNodes:
+                            if nodesL3.nodeName == 'tr':
+                                current_row = self._createObject(nodesL3)
+                                current_row.row = len(rows)
+                                cells = []
+                                for nodesL4 in nodesL3.childNodes:
+                                    if nodesL4.nodeName == 'td':
+                                        current_cell = self._createObject(nodesL4)
+                                        current_cell.row = current_row.row
+                                        current_cell.col = len(cells)
+                                        content = []
+                                        str_data = u''
+                                        for nodesL5 in nodesL4.childNodes:
+                                            if nodesL5.nodeName == 'shape':
+                                                shape_obj = self._createObject(nodesL5)
+                                                params = []
+                                                kwparams = {}
+                                                for nodesL6 in nodesL5.childNodes:
+                                                    if nodesL6.nodeName == 'parameter':
+                                                        param = self._createObject(nodesL6)
+                                                        param_type = type(param)
+                                                        if param_type is DictType:
+                                                            kwparams.update(param)
+                                                        elif param_type is ListType:
+                                                            params.extend(param)
+                                                shape_obj.params   = params
+                                                shape_obj.kwparams = kwparams
+                                                content.append(shape_obj.getFlowable(stylesheet=stylesheet))
+                                            
+                                            elif nodesL5.nodeName in content_objects:
+                                                content.append(self._createObject(nodesL5).getFlowable(stylesheet=stylesheet))
+                                            elif nodesL5.nodeType == 3:
+                                                str_data += nodesL5.data.strip()
+                                        if content == []:
+                                            if not str_data:
+                                                str_data = u' '
+                                            content.append(str_data.encode(self.encoding))
+                                        current_cell.content = content
+                                        cells.append(current_cell)
+
+                                current_row.cells = cells
+                                rows.append(current_row)
+                                current_obj.table.colcount = max(current_obj.table.colcount,len(cells))
+                        current_obj.table.rows = rows
+                        current_obj.table.rowcount = len(rows)
+                        obj.content.append(current_obj)
+
+                    elif nodesL2.nodeName == 'action':
+                        current_obj = self._createObject(nodesL2)
+                        params = []
+                        for nodesL3 in nodesL2.childNodes:
+                            if nodesL3.nodeName == 'parameter':
+                                param = self._createObject(nodesL3)
+                                if type(param) is ListType:
+                                    params.extend(param)
+                                else:
+                                    raise ValueError, 'Actions do not accept keyword parameters'
+                        current_obj.params = params
+                        obj.content.append(current_obj)
+
+                    elif nodesL2.nodeName == 'shape':
+                        current_obj = self._createObject(nodesL2)
+                        params = []
+                        kwparams = {}
+                        for nodesL3 in nodesL2.childNodes:
+                            if nodesL3.nodeName == 'parameter':
+                                param = self._createObject(nodesL3)
+                                param_type = type(param)
+                                if param_type is DictType:
+                                    kwparams.update(param)
+                                elif param_type is ListType:
+                                    params.extend(param)
+                        current_obj.params   = params
+                        current_obj.kwparams = kwparams
+                        obj.content.append(current_obj)
+
+        return obj
+        
+    def __call__(self,template,out=None):
+        doc = self._create(template)
+        return doc.create(template,out)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Parser.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Platypus.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Platypus.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Platypus.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,880 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   CMFReportTool - Generating PDF-Skins on the Fly from CMF-Sites
+#
+#   Copyright (C) 2002  net-labs Systemhaus GmbH
+#                                               info at net-labs.de
+#
+#   This library is free software; you can redistribute it and/or
+#   modify it under the terms of the GNU Lesser General Public
+#   License as published by the Free Software Foundation; either
+#   version 2.1 of the License, or (at your option) any later version.
+#
+#   This library 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
+#   Lesser General Public License for more details.
+#
+#   You should have received a copy of the GNU Lesser General Public
+#   License along with this library; if not, write to the Free Software
+#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+###############################################################################
+"""ReportTool Platypus objects.
+$Id$
+"""
+__version__='$Revision: 1.5 $'[11:-2]
+
+import os
+import string
+from types import TupleType
+
+import pprint
+import imp
+
+
+from reportlab.pdfgen import canvas
+from reportlab.platypus import XPreformatted, Preformatted, Frame, Image
+from reportlab.platypus import Table, TableStyle, Spacer
+from reportlab.platypus import BaseDocTemplate, ActionFlowable, Flowable
+from reportlab.platypus import PageTemplate, PageBreak
+from reportlab.lib.styles import ParagraphStyle
+from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
+from reportlab.lib import styles
+from reportlab.lib import pagesizes
+from reportlab.lib import colors
+
+default_pagesize = pagesizes.A4
+
+from Paragraph import Paragraph
+
+## Template releated
+
+class xmlTemplate:
+    def __init__(self):
+        self.filename = None
+        self.pagesize = "A4"
+        self.landscape = 0
+        self.showboundary = 0
+        self.leftmargin=10
+        self.rightmargin=10
+        self.topmargin=10
+        self.bottommargin=10
+        self.allowsplitting=1
+        
+        self.pagetemplates = []
+        self.stylesheet = []
+        
+    def create(self):
+        ps = getattr(pagesizes,self.pagesize,default_pagesize)
+        if self.landscape:
+            ps = pagesizes.landscape(ps)
+            
+        templates = map(lambda x,s=ps:x.create(s),self.pagetemplates)
+        dt = Template(self.filename,pagesize=ps,
+                 pageTemplates = templates,
+                 showBoundary = self.showboundary,
+                 leftMargin = self.leftmargin,
+                 rightMargin = self.rightmargin,
+                 topMargin = self.topmargin,
+                 bottomMargin = self.bottommargin,
+                 allowSplitting = self.allowsplitting)
+                 
+        # create StyleSheet and add custom styles
+        sheet = getDefaultStyleSheet()
+        if len(self.stylesheet) > 0:
+            for st in self.stylesheet:
+                sheet[st.name] = st.getStyle(sheet)
+        dt.setStyleSheet(sheet)
+        return dt
+                 
+        
+
+class xmlPageTemplate:
+    def __init__(self,id,nextid):
+        self.id = id
+        self.nextid = nextid
+        self.startframe = None
+        
+        self.graphics = []
+        self.frames = []
+        
+    def create(self,pagesize):
+        frames = map(lambda x:x.create(),self.frames)
+        pt = mPageTemplate(id=self.id,nextid=self.nextid,frames=frames,graphics=self.graphics,
+                   startframe=self.startframe,pagesize=pagesize)
+        return pt
+        
+
+
+class xmlFrame:
+    def __init__(self, id, nextid, x, y, width, height):
+        self.id = id
+        self.nextid = nextid
+        self.x = x
+        self.y = y
+        self.width = width
+        self.height = height
+        self.showboundary = 0    
+        self.leftpadding=10
+        self.righpadding=10
+        self.toppadding=10
+        self.bottompadding=10
+
+    def create(self):
+        f = mFrame(self.x,self.y,self.width,self.height,
+              leftPadding=self.leftpadding,
+              rightPadding=self.rightpadding,
+              topPadding=self.toppadding,
+              bottomPadding=self.bottompadding,
+              id=self.id,
+              nextid=self.nextid,
+              showBoundary=self.showboundary)
+        return f
+
+
+
+
+## Content releated (Flowables)
+
+class xmlDocument:
+    
+    def __init__(self):
+        self.filename = None
+        self.title = None
+        self.author = None
+        self.subject = None
+        
+        self.content = []
+
+    def create(self, template, out=None):
+        template.title = self.title
+        template.author = self.author
+        template.subject = self.subject
+
+        fname = out or self.filename or template.filename    
+        stylesheet = template.getStyleSheet()
+        return template.build(
+            [fl.getFlowable(stylesheet) for fl in self.content],
+            filename=fname)
+        
+
+class xmlParagraph:
+    """This is a placeholder for a paragraph."""
+    def __init__(self):
+        self.rawtext = ''
+        self.style = None
+
+    def getFlowable(self, stylesheet={}):
+        p = Paragraph(
+            self.rawtext,
+            stylesheet[self.style],
+            self.bulletText,
+            context=stylesheet
+            )
+        return p
+
+
+class xmlParagraphStyle:
+    """ This is a placeholder for a paragraphstyle """
+    def __init__(self,name,parent=None):
+        self.name = name
+        self.parent = parent
+        
+        self.attributes = {}        
+        
+    def getStyle(self,sheet={}):
+        parent =  sheet.get(self.parent,None)
+        p = ParagraphStyle(self.name,parent)
+        for k,v in self.attributes.items():
+            setattr(p,k,v)
+        return p
+        
+
+class xmlPreformattedText:
+    """Use this for source code, or stuff you do not want to wrap"""
+    def __init__(self):
+        self.rawtext = ''
+        self.style = None
+        self.dedent = 0
+
+    def getFlowable(self, stylesheet={}):
+        return Preformatted(self.rawtext, stylesheet[self.style],dedent=self.dedent)
+
+class xmlXPreformattedText:
+    """Use this for source code, or stuff you do not want to wrap"""
+    def __init__(self):
+        self.rawtext = ''
+        self.style = None
+        self.dedent = 0
+
+    def getFlowable(self, stylesheet={}):
+        return XPreformatted(self.rawtext, stylesheet[self.style],dedent=self.dedent)
+
+
+
+class xmlImage:
+    """Flowing image within the text"""
+    def __init__(self):
+        self.filename = None
+        self.width = None
+        self.height = None
+
+    def getFlowable(self, stylesheet={}):
+        return Image(self.filename, self.width, self.height)
+
+
+class xmlTable:
+    """Designed for bulk loading of data for use in presentations."""
+    def __init__(self):
+        self.table = None
+        self.style = None  #tag args must specify
+        self.rowheight = None  #tag args can override
+        self.colwidth = None #tag args can override
+        self.splitbyrow = 1
+        self.repeatrows = 0
+        self.repeatcols = 0
+
+    def getFlowable(self, stylesheet={}):
+        
+        table = self.table
+        
+        heights = map(lambda x,y=self.rowheight: getattr(x,'rowheight',None) or y,table.rows)
+
+        stylecmds = []
+        if self.style:
+            stylecmds = stylesheet[self.style].getCommands()[:]
+        
+        widths = []
+        for c in range(0,table.colcount):
+            maxwidth = self.colwidth
+            for row in table.rows:
+                if len(row.cells) > c:
+                    maxwidth = max(maxwidth,row.cells[c].colwidth)
+                        
+            widths.append(maxwidth)
+        
+        data = []
+        for row in table.rows:
+            rowdata = []
+
+            if row.stylecmd:
+                stylecmds.extend(row.getStyles())
+
+            for c in range(0,table.colcount):
+                if len(row.cells) > c:
+                    cell = row.cells[c]
+
+                    if cell.stylecmd:
+                        stylecmds.extend(cell.getStyles())
+                    
+                    content = cell.content
+                    if len(content) == 1:
+                        content = content[0]
+                    rowdata.append(content)
+                else:
+                    rowdata.append(None)
+            data.append(rowdata)
+
+        t = Table(data,
+              colWidths=widths,
+              rowHeights=heights,
+              splitByRow=self.splitbyrow,
+              repeatRows=self.repeatrows,
+              repeatCols=self.repeatcols)
+        style = TableStyle(stylecmds)
+        t.setStyle(style)
+        return t
+
+
+class xmlTableStyle:
+    """ This is a placeholder for a tablestyle """
+    def __init__(self,name):
+        self.name = name
+        
+        self.commands = []
+        
+    def getStyle(self, sheet={}):
+        p = TableStyle(self.commands)
+        return p
+
+
+class xmlSpacer:
+    def __init__(self):
+        self.height = 24  #points
+        
+    def getFlowable(self, stylesheet={}):
+        return Spacer(72, self.height)
+
+class xmlAction:
+    def __init__(self):
+        self.action = None
+        self.params = []
+        
+    def getFlowable(self, stylesheet={}):
+        return ActionFlowable([self.action]+self.params)
+
+
+class xmlShape:
+
+    def __init__(self):
+        self.factory  = None
+        self.params   = []
+        self.kwparams = {}
+
+    def getFlowable(self, stylesheet={}):
+        # XXX Potential Security problem !!!!!!
+        # we cannot use the mechanism from PageTemplates/PythonScripts here,
+        # without making RenderPDF dependent on Zope2 :(((((
+        factory = resolveFactory(self.factory)
+        return apply(factory, self.params, self.kwparams)
+
+
+
+## Static Elements
+
+    
+class xmlFixedImage:
+    """You place this on the page, rather than flowing it"""
+    def __init__(self):
+        self.filename = None
+        self.x = 0
+        self.y = 0
+        self.width = None
+        self.height = None
+
+    def drawOn(self, canv):
+        if self.filename:
+            canv.drawInlineImage(
+                        self.filename,
+                        self.x,
+                        self.y,
+                        self.width,
+                        self.height
+                           )
+
+
+class xmlRectangle:
+    def __init__(self, x, y, width, height):
+        self.x = x
+        self.y = y
+        self.width = width
+        self.height = height
+        self.fillColor = None
+        self.strokeColor = (1,1,1)
+        self.lineWidth=0
+
+    def drawOn(self, canv):
+        canv.saveState()
+        canv.setLineWidth(self.lineWidth)
+        if self.fillColor:
+            r,g,b = self.fillColor
+            canv.setFillColorRGB(r,g,b)
+        if self.strokeColor:
+            r,g,b = self.strokeColor
+            canv.setStrokeColorRGB(r,g,b)
+        canv.rect(self.x, self.y, self.width, self.height,
+            stroke=(self.strokeColor<>None),
+            fill = (self.fillColor<>None)
+            )
+        canv.restoreState()
+
+                   
+class xmlRoundRect:
+    def __init__(self, x, y, width, height, radius):
+        self.x = x
+        self.y = y
+        self.width = width
+        self.height = height
+        self.radius = radius
+        self.fillColor = None
+        self.strokeColor = (1,1,1)
+        self.lineWidth=0
+
+    def drawOn(self, canv):
+        canv.saveState()
+        canv.setLineWidth(self.lineWidth)
+        if self.fillColor:
+            r,g,b = self.fillColor
+            canv.setFillColorRGB(r,g,b)
+        if self.strokeColor:
+            r,g,b = self.strokeColor
+            canv.setStrokeColorRGB(r,g,b)
+        canv.roundRect(self.x, self.y, self.width, self.height,
+            self.radius,
+            stroke=(self.strokeColor<>None),
+            fill = (self.fillColor<>None)
+            )
+        canv.restoreState()
+
+
+class xmlLine:
+    def __init__(self, x1, y1, x2, y2):
+        self.x1 = x1
+        self.y1 = y1
+        self.x2 = x2
+        self.y2 = y2
+        self.fillColor = None
+        self.strokeColor = (1,1,1)
+        self.lineWidth=0
+
+
+    def drawOn(self, canv):
+        canv.saveState()
+        canv.setLineWidth(self.lineWidth)
+        if self.strokeColor:
+            r,g,b = self.strokeColor
+            canv.setStrokeColorRGB(r,g,b)
+        canv.line(self.x1, self.y1, self.x2, self.y2)
+        canv.restoreState()
+
+
+class xmlEllipse:
+    def __init__(self, x1, y1, x2, y2):
+        self.x1 = x1
+        self.y1 = y1
+        self.x2 = x2
+        self.y2 = y2
+        self.fillColor = None
+        self.strokeColor = (1,1,1)
+        self.lineWidth=0
+
+
+    def drawOn(self, canv):
+        canv.saveState()
+        canv.setLineWidth(self.lineWidth)
+        if self.strokeColor:
+            r,g,b = self.strokeColor
+            canv.setStrokeColorRGB(r,g,b)
+        if self.fillColor:
+            r,g,b = self.fillColor
+            canv.setFillColorRGB(r,g,b)
+        canv.ellipse(self.x1, self.y1, self.x2, self.y2,
+            stroke=(self.strokeColor<>None),
+            fill = (self.fillColor<>None)
+            )
+        canv.restoreState()
+
+
+class xmlPolygon:
+    def __init__(self, pointlist):
+        self.points = pointlist
+        self.fillColor = None
+        self.strokeColor = (1,1,1)
+        self.lineWidth=0
+
+
+    def drawOn(self, canv):
+        canv.saveState()
+        canv.setLineWidth(self.lineWidth)
+        if self.strokeColor:
+            r,g,b = self.strokeColor
+            canv.setStrokeColorRGB(r,g,b)
+
+        path = canv.beginPath()
+        (x,y) = self.points[0]
+        path.moveTo(x,y)
+        for (x,y) in self.points[1:]:
+            path.lineTo(x,y)
+        path.close()
+        canv.drawPath(path, stroke=(self.strokeColor<>None))
+        canv.restoreState()
+
+    
+class xmlString:
+    def __init__(self, x, y):
+        self.text = ''
+        self.x = x
+        self.y = y
+        self.align = TA_LEFT
+        self.font = 'Times-Roman'
+        self.size = 12
+        self.color = (0,0,0)
+        self.hasInfo = 0  # these can have data substituted into them
+
+    def normalizeText(self):
+        """It contains literal XML text typed over several lines.
+        We want to throw away
+        tabs, newlines and so on, and only accept embedded string
+        like '\n'"""
+        lines = string.split(self.text, '\n')
+        newtext = []
+        for line in lines:
+            newtext.append(string.strip(line))
+            #accept all the '\n' as newlines
+
+        self.text = newtext
+
+    def drawOn(self, canv):
+        # for a string in a section, this will be drawn several times;
+        # so any substitution into the text should be in a temporary
+        # variable
+        if self.hasInfo:
+            # provide a dictionary of stuff which might go into
+            # the string, so they can number pages, do headers
+            # etc.
+            info = {}
+            info['title'] = canv._doc.info.title
+            info['author'] = canv._doc.info.author
+            info['subject'] = canv._doc.info.subject
+            info['page'] = canv.getPageNumber()
+            drawText = self.text % info
+        else:
+            drawText = self.text
+
+        if self.color is None:
+            return
+        lines = string.split(string.strip(drawText), '\\n')
+        canv.saveState()
+        canv.setFont(self.font, self.size)
+        r,g,b = self.color
+        canv.setFillColorRGB(r,g,b)
+        cur_y = self.y
+        for line in lines:
+            if self.align == TA_LEFT:
+                canv.drawString(self.x, cur_y, line)
+            elif self.align == TA_CENTER:
+                canv.drawCentredString(self.x, cur_y, line)
+            elif self.align == TA_RIGHT:
+                canv.drawRightString(self.x, cur_y, line)
+            cur_y = cur_y - 1.2*self.size
+
+        canv.restoreState()
+
+
+
+## table helper
+
+class xTable:
+    def __init__(self,rows=[]):
+        self.rows=rows
+        self.rowcount=0
+        self.colcount=0
+        
+class xRow:
+    def __init__(self,cells=[]):
+        self.cells=cells
+        self.rowheight=0
+        self.row=None
+        self.stylecmd=None        
+        
+    def getStyles(self):
+        if type(self.stylecmd) is TupleType:
+            self.stylecmd = [self.stylecmd]
+        cmds = []
+        for sc in self.stylecmd:
+            cmds.append(tuple([sc[0],(0,self.row),(-1,self.row)]+list(sc[1:])))
+        return cmds
+        
+        
+class xCell:
+    def __init__(self,content=[]):
+        self.content=content
+        self.colwidth=0
+        self.row=None
+        self.col=None
+        self.stylecmd=None
+
+    def getStyles(self):
+        if type(self.stylecmd) is TupleTupe:
+            self.stylecmd = [self.stylecmd]
+        cmds = []
+        for sc in self.stylecmd:
+            cmds.append(tuple([sc[0],(self.col,self.row),(self.col,self.row)]+list(sc[1:])))
+        return cmds
+
+
+## Layout Logic
+
+
+class mFrame(Frame):
+    
+    def __init__(self, x1, y1, width,height, leftPadding=6, bottomPadding=6,
+            rightPadding=6, topPadding=6, id=None, nextid=None, showBoundary=0):
+        Frame.__init__(self,x1,y1,width,height,
+              leftPadding=leftPadding,
+              rightPadding=rightPadding,
+              topPadding=topPadding,
+              bottomPadding=bottomPadding,
+              id=id,
+              showBoundary=showBoundary)
+        self.nextid = nextid
+        self.used = 0
+
+
+class mPageTemplate(PageTemplate):
+    
+    def __init__(self,id=None,nextid=None,frames=[],graphics=[],pagesize=default_pagesize,startframe=None):
+        PageTemplate.__init__(self,id=id,frames=frames,pagesize=pagesize)
+        self.nextid = nextid or self.id
+        self.startframe = startframe
+        self.graphics = graphics
+
+    def beforeDrawPage(self,canv,doc):
+        for graphic in self.graphics:
+            graphic.drawOn(canv)
+
+
+
+
+class Template(BaseDocTemplate):
+    """
+    """
+
+
+    # Per Template Stylesheet support
+    def setStyleSheet(self, stylesheet):
+        self.__stylesheet = stylesheet
+
+    def getStyleSheet(self):
+        return self.__stylesheet
+
+ 
+    def handle_pageBegin(self):
+        self.page = self.page + 1
+        self.pageTemplate.beforeDrawPage(self.canv,self)
+        self.pageTemplate.checkPageSize(self.canv,self)
+        self.pageTemplate.onPage(self.canv,self)
+        for f in self.pageTemplate.frames: f._reset()
+        self.beforePage()
+        if hasattr(self,'_nextFrameIndex'):
+            del self._nextFrameIndex
+            
+        if hasattr(self,'_linkedFrame'):
+            nextframe = self._linkedFrame
+            del (self._linkedFrame)
+        elif self.pageTemplate.startframe is not None:
+            nextframe = self.pageTemplate.startframe
+        else:
+            nextframe = None
+            
+        found = 0
+        for f in self.pageTemplate.frames:
+            f.used = 0
+            if f.id == nextframe:
+                self.frame = f
+                found = 1
+        if not found:
+            self.frame = self.pageTemplate.frames[0]
+
+        self._handle_nextPageTemplate(self.pageTemplate.nextid)
+        
+        
+    def handle_frameEnd(self,resume=0):
+        ''' Handles the semantics of the end of a frame. This includes the selection of
+            the next frame or if this is the last frame then invoke pageEnd.
+        '''
+        self.frame.used = 1
+        nextframe = getattr(self.frame,'nextid',None)
+        
+        if hasattr(self,'_nextFrameIndex'):
+            self.frame = self.pageTemplate.frames[self._nextFrameIndex]
+            del self._nextFrameIndex
+            self.handle_frameBegin(resume)
+        elif nextframe is not None:
+            found = 0
+            for f in self.pageTemplate.frames:
+                if f.id == nextframe and not f is self.frame and not f.used==1:
+                    self.frame = f
+                    found = 1
+            if not found:
+                self._linkedFrame = nextframe
+                self.handle_pageEnd()
+                self.frame = None
+            
+        elif hasattr(self.frame,'lastFrame') or self.frame is self.pageTemplate.frames[-1]:
+            self.handle_pageEnd()
+            self.frame = None
+        else:
+            f = self.frame
+            self.frame = self.pageTemplate.frames[self.pageTemplate.frames.index(f) + 1]
+            self.handle_frameBegin()
+         
+
+
+    def build(self,flowables,filename=None, canvasmaker=canvas.Canvas):
+        """Build the document from a list of flowables.
+           If the filename argument is provided then that filename is used
+           rather than the one provided upon initialization.
+           If the canvasmaker argument is provided then it will be used
+           instead of the default.      For example a slideshow might use
+           an alternate canvas which places 6 slides on a page (by
+           doing translations, scalings and redefining the page break
+           operations).
+        """
+        self._calc()
+        #assert filter(lambda x: not isinstance(x,Flowable), flowables)==[], "flowables argument error"
+        self._startBuild(filename,canvasmaker)
+ 
+        self.canv.setTitle(self.title or '')
+        self.canv.setAuthor(self.author or 'unknown')
+        self.canv.setSubject(self.subject or '')
+        self.canv.setPageCompression(1)
+
+        while len(flowables):
+            self.clean_hanging()
+            self.handle_flowable(flowables)
+ 
+        self._endBuild()
+
+
+
+
+
+## resolve Shape Factory (taken from zope3)
+
+def resolveFactory(name, _silly=('__doc__',), _globals={}):
+    name = name.strip()
+
+    if name.endswith('.') or name.endswith('+'):
+        name = name[:-1]
+        repeat = 1
+    else:
+        repeat = 0
+
+    names=name.split('.')
+    last=names[-1]
+    mod='.'.join(names[:-1])
+
+    if not mod:
+        return __import__(name, _globals, _globals, _silly)
+
+    while 1:
+        m=__import__(mod, _globals, _globals, _silly)
+        try:
+            a=getattr(m, last)
+        except AttributeError:
+            if not repeat:
+                return __import__(name, _globals, _globals, _silly)
+
+        else:
+            if not repeat or (not isinstance(a, ModuleType)):
+                return a
+        mod += '.' + last
+
+
+        
+## Styles
+def getDefaultStyleSheet():
+    """Returns a dictionary of styles to get you started.  We will
+    provide a way to specify a module of these.  Note that this
+    ust includes TableStyles as well as ParagraphStyles for any
+    tables you wish to use."""
+    stylesheet = {}
+
+    para = ParagraphStyle('Normal', None)   #the ancestor of all
+    para.fontName = 'Helvetica'
+    para.fontSize = 14
+    stylesheet['Normal'] = para
+
+    para = ParagraphStyle('Heading1', stylesheet['Normal'])
+    para.fontName = 'Helvetica-Bold'
+    para.fontSize = 20
+    para.alignment = TA_CENTER
+    stylesheet['Heading1'] = para
+
+    para = ParagraphStyle('Cell', None)   #the ancestor of all
+    para.fontName = 'Helvetica-Bold'
+    para.alignment = TA_CENTER
+    para.fontSize = 13
+    stylesheet['Cell'] = para
+
+    para = ParagraphStyle('CellHeading', stylesheet['Normal'])
+    para.fontName = 'Helvetica-Bold'
+    para.fontSize = 14
+    para.alignment = TA_CENTER
+    stylesheet['CellHeading'] = para
+
+    #now for a table
+    ts = TableStyle([
+        ('FONT', (0,0), (-1,-1), 'Helvetica', 10),
+        ('LINEABOVE', (0,0), (-1,0), 2, colors.black),
+        ('LINEABOVE', (0,1), (-1,-1), 0.25, colors.black),
+        ('LINEBELOW', (0,-1), (-1,-1), 2, colors.black),
+        ('LINEBEFORE', (-1,0), (-1,-1), 0.5, colors.black),
+        ('ALIGN', (2,0), (-1,-1), 'RIGHT'),   #all numeric cells right aligned
+        ('BACKGROUND', (0,0), (-1,0), colors.Color(0.8,0.8,0.8))
+        ])
+    stylesheet['Table'] = ts
+    
+    #This one is spaced out a bit...
+    para = ParagraphStyle('BodyText', stylesheet['Normal'])
+    para.spaceBefore = 12
+    stylesheet['BodyText'] = para
+
+    #Indented, for lists
+    para = ParagraphStyle('Indent', stylesheet['Normal'])
+    para.leftIndent = 36
+    para.firstLineIndent = 36
+    stylesheet['Indent'] = para
+
+    para = ParagraphStyle('Centered', stylesheet['Normal'])
+    para.alignment = TA_CENTER
+    stylesheet['Centered'] = para
+
+    para = ParagraphStyle('BigCentered', stylesheet['Normal'])
+    para.spaceBefore = 12
+    para.alignment = TA_CENTER
+    stylesheet['BigCentered'] = para
+
+    para = ParagraphStyle('Italic', stylesheet['BodyText'])
+    para.fontName = 'Helvetica-Oblique'
+    stylesheet['Italic'] = para
+
+    para = ParagraphStyle('Title', stylesheet['Normal'])
+    para.fontName = 'Arial'
+    para.fontSize = 48
+    para.leading = 58
+    para.alignment = TA_CENTER
+    stylesheet['Title'] = para
+
+    para = ParagraphStyle('Heading2', stylesheet['Normal'])
+    para.fontName = 'Arial-Bold'
+    para.fontSize = 28
+    para.leading = 34
+    para.spaceBefore = 24
+    stylesheet['Heading2'] = para
+
+    para = ParagraphStyle('Heading3', stylesheet['Normal'])
+    para.fontName = 'Helvetica-BoldOblique'
+    para.spaceBefore = 24
+    stylesheet['Heading3'] = para
+
+    para = ParagraphStyle('Heading4', stylesheet['Normal'])
+    para.fontName = 'Helvetica-BoldOblique'
+    para.spaceBefore = 6
+    stylesheet['Heading4'] = para
+
+    para = ParagraphStyle('Bullet', stylesheet['Normal'])
+    para.firstLineIndent = 40
+    para.leftIndent = 56
+    para.spaceBefore = 6
+    para.bulletFontName = 'Symbol'
+    para.bulletFontSize = 24
+    para.bulletIndent = 20
+    stylesheet['Bullet'] = para
+
+    para = ParagraphStyle('Definition', stylesheet['Normal'])
+    #use this for definition lists
+    para.firstLineIndent = 72
+    para.leftIndent = 72
+    para.bulletIndent = 0
+    para.spaceBefore = 12
+    para.bulletFontName = 'Helvetica-BoldOblique'
+    para.bulletFontSize = 24
+    stylesheet['Definition'] = para
+
+    para = ParagraphStyle('Code', stylesheet['Normal'])
+    para.fontName = 'Courier'
+    para.fontSize = 16
+    para.leading = 18
+    para.leftIndent = 36
+    stylesheet['Code'] = para
+
+    para = ParagraphStyle('Small', stylesheet['Normal'])
+    para.fontSize = 12
+    para.leading = 14
+    stylesheet['Small'] = para
+
+    return stylesheet


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/Platypus.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/README.txt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/README.txt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/README.txt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,113 @@
+===================
+The Template Parser
+===================
+
+This document demonstrates the parsing capabilities of the PML-to-PDF template
+parser.
+
+  >>> from z3c.pdftemplate.pml2pdf.Parser import TemplateParser
+
+To make life easier, we create a simple helper function that converts an XML
+string to a DOM tree and creates the template object using the parser:
+
+  >>> import xml.dom.minidom
+  >>> def getTemplate(xml_string):
+  ...     dom = xml.dom.minidom.parseString(xml_string)
+  ...     return TemplateParser(dom, 'utf-8')()
+
+``template`` Element
+--------------------
+
+The most outer XML element for the template file is the ``template`` element.
+
+  >>> template = getTemplate('''<?xml version="1.0" encoding="utf-8"?>
+  ...     <template
+  ...         filename="contents.pdf"
+  ...         pagesize="A4"
+  ...         landscape="0"
+  ...         showboundary="0"
+  ...         leftmargin="1cm"
+  ...         rightmargin="1cm"
+  ...         topmargin="1cm"
+  ...         bottommargin="1cm"
+  ...         allowsplitting="1">
+  ...     </template>''')
+
+  >>> template.filename
+  'contents.pdf'
+  >>> template.showBoundary
+  0
+  >>> int(template.leftMargin)
+  28
+  >>> int(template.rightMargin)
+  28
+  >>> int(template.topMargin)
+  28
+  >>> int(template.bottomMargin)
+  28
+  >>> template.allowSplitting
+  1
+
+
+``stylesheet`` Element
+----------------------
+
+This is just a grouping element and has no functionality in itself. The
+following elements can be contained in this element.
+
+
+``paragraphstyle`` Element
+--------------------------
+
+  >>> template = getTemplate('''<?xml version="1.0" encoding="utf-8"?>
+  ...     <template><stylesheet>
+  ...       <paragraphstyle
+  ...           name="BodyText"
+  ...           fontName="Helvetica"
+  ...           fontSize="10"
+  ...           align="LEFT"
+  ...           firstLineIndent="0cm"
+  ...           leftIndent="0.5cm"
+  ...           rightIndent="0cm"
+  ...           spaceBefore="0"
+  ...           spaceAfter="0"
+  ...           leading="0.5cm"
+  ...           bulletFontName="Helvetica"
+  ...           bulletIndent="0cm"
+  ...           bulletFontSize="10" />
+  ...     </stylesheet></template>''')
+
+  >>> para = template.getStyleSheet()['BodyText']
+  >>> para.fontName
+  'Helvetica'
+  >>> para.bulletFontName
+  'Helvetica'
+  >>> para.parent is None
+  True
+  >>> para.firstLineIndent
+  0.0
+  >>> int(para.leftIndent)
+  14
+  >>> para.rightIndent
+  0.0
+  >>> para.backColor is None
+  True
+  >>> para.alignment
+  0
+  >>> para.name
+  'BodyText'
+  >>> int(para.leading)
+  14
+  >>> para.bulletIndent
+  0.0
+  >>> para.bulletFontSize
+  10
+  >>> para.fontSize
+  10
+  >>> para.textColor
+  Color(0,0,0)
+  >>> para.spaceBefore
+  0.0
+  >>> para.spaceAfter
+  0.0
+


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/__init__.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/__init__.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/__init__.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   CMFReportTool - Generating PDF-Skins on the Fly from CMF-Sites
+#
+#   Copyright (C) 2002  net-labs Systemhaus GmbH
+#                                               info at net-labs.de
+#
+#   This library is free software; you can redistribute it and/or
+#   modify it under the terms of the GNU Lesser General Public
+#   License as published by the Free Software Foundation; either
+#   version 2.1 of the License, or (at your option) any later version.
+#
+#   This library 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
+#   Lesser General Public License for more details.
+#
+#   You should have received a copy of the GNU Lesser General Public
+#   License along with this library; if not, write to the Free Software
+#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+###############################################################################
+"""Portal forms __init__.
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+__version__='$Revision: 1.1.1.1 $'[11:-2]


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/tests.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/tests.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/tests.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,118 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+###############################################################################
+"""Unittests for RenderPDF Parser
+
+$Id$
+"""
+
+import unittest
+from StringIO import StringIO
+import xml.dom.minidom
+import os.path
+import urllib
+
+from reportlab.lib import colors
+from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
+from reportlab.lib.units import toLength
+
+from zope.testing import doctest
+
+from z3c.pdftemplate.pml2pdf import Platypus
+from z3c.pdftemplate.pml2pdf.Parser import TemplateParser, DocumentParser
+
+
+test_template_xml_template = '''
+<template filename="default.pdf"
+            pagesize="A4"
+            landscape="0"
+            showboundary="0"
+            leftmargin="1cm"
+            rightmargin="1cm"
+            topmargin="1cm"
+            bottommargin="1cm"
+            allowsplitting="1">
+  <pagetemplate id="Page" >
+   <frame  id="content"
+           nextid="content"
+           x="2cm"
+           y="1.5cm"
+           width="17cm"
+           height="25.5cm"
+           leftpadding="0.1cm"
+           rightpadding="0.1cm"
+           toppadding="0.5cm"
+           bottompadding="0.5cm"
+           showBoundary="0"/>
+  </pagetemplate>
+</template>
+'''
+
+document_xml_template = '''
+<document filename="report01.pdf">
+  <title>Test Document</title>
+  <author>Ulrich Eck</author>
+  <subject>only for testing ...</subject>
+  <content>
+  %s
+  </content>
+</document>
+'''
+
+
+class TestDocumentParser(unittest.TestCase):
+
+    def setUp(self):
+        template_dom = xml.dom.minidom.parseString(test_template_xml_template)
+        self.template = TemplateParser(template_dom, 'utf-8')()
+
+    def _parse(self, content=''):
+        xml_data = document_xml_template % content
+        xml_dom = xml.dom.minidom.parseString(xml_data)
+        return DocumentParser(xml_dom, 'utf-8')(self.template)
+
+    def xxx_test_paragraph(self):
+        xml_fragment = '''<para style="test">Test</para>'''
+        doc = self._parse(xml_fragment)
+        el = doc.dom.content[0]
+        self.assert_(isinstance(el, Platypus.xmlParagraph))
+        self.assertEqual(el.style, 'test')
+        self.assertEqual(el.rawtext, 'Test')
+
+        xml_fragment = '''<para style="Bullet" bullettext="X">Test</para>'''
+        doc = self._parse(xml_fragment)
+        el = doc.dom.content[0]
+        self.assert_(isinstance(el, Platypus.xmlParagraph))
+        self.assertEqual(el.style, 'Bullet')
+        self.assertEqual(el.bulletText, 'X')
+        self.assertEqual(el.rawtext, 'Test')
+
+    def xxx_test_prefmt(self):
+        xml_fragment = '''<prefmt style="test" dedent="3">Test</prefmt>'''
+        doc = self._parse(xml_fragment)
+        el = doc.doc.content[0]
+        self.assert_(isinstance(el, Platypus.xmlPreformattedText))
+        self.assertEqual(el.style, 'test')
+        self.assertEqual(el.dedent, 3)
+        self.assertEqual(el.rawtext, 'Test')
+
+
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(TestDocumentParser),
+        doctest.DocFileSuite('README.txt')
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/pml2pdf/tests.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rest.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/rest.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/rest.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,92 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+###############################################################################
+"""ReST-to-PDF Resources
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import xml.dom.minidom
+from docutils.core import publish_string
+from StringIO import StringIO
+
+from zope.interface import implements
+from zope.app.publisher.browser.resource import Resource
+from zope.publisher.interfaces.browser import IBrowserPublisher
+
+import z3c.pdftemplate.rlpdf.rlpdf
+from z3c.pdftemplate.pml2pdf.Parser import DocumentParser
+from z3c.pdftemplate.pdf import PDFTemplateGenerator
+
+
+class PDFWriter(z3c.pdftemplate.rlpdf.rlpdf.Writer):
+
+    def __init__(self, template):
+        z3c.pdftemplate.rlpdf.rlpdf.Writer.__init__(self)
+        self.doc = template
+        self.doc.subject = ''
+
+    def translate(self):
+        visitor = self.translator_class(self.document)
+        visitor.styleSheet = self.doc.getStyleSheet()
+        self.document.walkabout(visitor)
+        self.story = visitor.as_what()
+        self.output = self.record()
+
+    def record(self):
+        out = StringIO()
+        self.doc.filename = out
+        self.doc.build(self.story)
+        return out.getvalue()
+
+class ReSTPDFResource(PDFTemplateGenerator, Resource):
+
+    implements(IBrowserPublisher)
+
+    def __init__(self, path, template, request):
+        self.path = path
+        self.template = template
+        self.request = request
+        # Needed for the page template view class
+        self.context = template
+
+    def publishTraverse(self, request, name):
+        '''See interface IBrowserPublisher'''
+        raise NotFound(None, name)
+
+    def browserDefault(self, request):
+        '''See interface IBrowserPublisher'''
+        return self, ()
+
+    def __call__(self):
+        template = self.getPDFTemplate()
+        pdf = publish_string(open(self.path, 'r').read(),
+                             writer=PDFWriter(template))
+
+        # Set the content type to application/pdf
+        self.request.response.setHeader('content-type', 'application/pdf')
+        
+        return pdf
+
+
+class ReSTPDFResourceFactory(object):
+    """A factory that generates PDF generating resource."""
+
+    def __init__(self, path, template):
+        self.__path = path
+        self.__template = template
+
+    def __call__(self, request):
+        return ReSTPDFResource(self.__path, self.__template, request)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rest.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/README.txt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/README.txt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/README.txt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,2 @@
+modules from reportlab tools
+


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/__init__.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/__init__.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/__init__.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#	Copyright (c) 2000-2001, ReportLab Inc.
+#	All rights reserved.
+#
+#	Redistribution and use in source and binary forms, with or without 
+#   modification, are permitted provided that the following conditions are 
+#   met:
+#
+#		*	Redistributions of source code must retain the above copyright 
+#           notice, this list of conditions and the following disclaimer. 
+#		*	Redistributions in binary form must reproduce the above copyright 
+#           notice, this list of conditions and the following disclaimer in 
+#           the documentation and/or other materials provided with the 
+#           distribution. 
+#		*	Neither the name of the company nor the names of its contributors 
+#           may be used to endorse or promote products derived from this 
+#           software without specific prior written permission. 
+#
+#	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+#   ARE DISCLAIMED. IN NO EVENT SHALL THE OFFICERS OR CONTRIBUTORS BE LIABLE 
+#   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+#   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
+#   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+#   CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+#   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
+#   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+#	SUCH DAMAGE.
+#
+###############################################################################
+
+from rlpdf import Writer
+from stylesheet import getStyleSheet
+from rltemplate import RLDocTemplate


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rllicense.txt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rllicense.txt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rllicense.txt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,29 @@
+#####################################################################################
+#
+#	Copyright (c) 2000-2001, ReportLab Inc.
+#	All rights reserved.
+#
+#	Redistribution and use in source and binary forms, with or without modification,
+#	are permitted provided that the following conditions are met:
+#
+#		*	Redistributions of source code must retain the above copyright notice,
+#			this list of conditions and the following disclaimer. 
+#		*	Redistributions in binary form must reproduce the above copyright notice,
+#			this list of conditions and the following disclaimer in the documentation
+#			and/or other materials provided with the distribution. 
+#		*	Neither the name of the company nor the names of its contributors may be
+#			used to endorse or promote products derived from this software without
+#			specific prior written permission. 
+#
+#	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+#	ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+#	WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+#	IN NO EVENT SHALL THE OFFICERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+#	INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+#	TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+#	OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+#	IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+#	IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+#	SUCH DAMAGE.
+#
+#####################################################################################


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rllicense.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rlpdf.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rlpdf.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rlpdf.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,793 @@
+#! /usr/bin/env python
+
+"""
+:Author: Engelbert Gruber
+:Contact: goodger at users.sourceforge.net
+:Revision: $Revision: 1.4 $
+:Date: $Date: 2003/05/05 02:23:49 $
+:Copyright: This module has been placed in the public domain.
+
+Simple pdf writer.
+
+The output uses reportlabs module.
+
+Some stylesheet is needed.
+"""
+
+__docformat__ = 'reStructuredText'
+
+
+import time
+from types import ListType, TupleType, UnicodeType
+from docutils import writers, nodes, languages
+
+from stylesheet import getStyleSheet
+from rltemplate import RLDocTemplate
+
+from reportlab.lib.styles import ParagraphStyle
+from reportlab.lib.enums import *
+from reportlab.lib.pagesizes import A4
+from reportlab.platypus import *
+from reportlab.platypus.para import Paragraph
+from reportlab.lib import colors
+from reportlab.lib.units import inch
+from StringIO import StringIO
+
+class Writer(writers.Writer):
+
+    supported = ('pdf','rlpdf')
+    """Formats this writer supports."""
+
+    settings_spec = (
+        'PDF-Specific Options',
+        None,
+        (('Format for footnote references: one of "superscript" or '
+          '"brackets".  Default is "brackets".',
+          ['--footnote-references'],
+          {'choices': ['superscript', 'brackets'], 'default': 'brackets',
+           'metavar': '<FORMAT>'}),))
+
+    output = None
+    """Final translated form of `document`."""
+
+    def __init__(self):
+        writers.Writer.__init__(self)
+        self.translator_class = PDFTranslator
+
+    def translate(self):
+        visitor = self.translator_class(self.document)
+        self.document.walkabout(visitor)
+        self.story = visitor.as_what()
+        self.output = self.record()
+
+    def record(self):
+        from reportlab.platypus import SimpleDocTemplate
+        out = StringIO()
+        doc = SimpleDocTemplate(out, pagesize=A4)
+        doc.build(self.story)
+        return out.getvalue()
+
+    def lower(self):
+        return 'pdf'
+
+class PDFTranslator(nodes.NodeVisitor):
+
+    def __init__(self, doctree):
+        self.settings = settings = doctree.settings
+        self.styleSheet = getStyleSheet()
+        nodes.NodeVisitor.__init__(self, doctree)
+        self.language = languages.get_language(doctree.settings.language_code)
+        self.in_docinfo = None
+        self.head = []
+        self.body = []
+        self.foot = []
+        self.sectionlevel = 0
+        self.context = []
+        self.topic_class = ''
+        self.story = []
+        self.bulletText = '\267'	# maybe move this into stylesheet.
+        self.bulletlevel = 0
+
+    def as_what(self):
+        return self.story
+
+    def encode(self, text):
+        """Encode special characters in `text` & return."""
+        if type(text) is UnicodeType:
+            text = text.replace(u'\u2020', u' ')
+            text = text.replace(u'\xa0', u' ')
+            text = text.encode('utf-8')
+        #text = text.replace("&", "&amp;")
+        #text = text.replace("<", '"')
+        #text = text.replace('"', "(quot)")
+        #text = text.replace(">", '"')
+        # footnotes have character values above 128 ?
+        return text
+
+    def append_para(self, text, in_style='Normal', bulletText=None):
+        if type(text) in (ListType, TupleType):
+            text = ''.join([self.encode(t) for t in text])
+        style = self.styleSheet[in_style]
+        self.story.append(Paragraph(self.encode(text), style, \
+                                    bulletText=bulletText, context=self.styleSheet))
+
+    def starttag(self, node, tagname, suffix='\n', **attributes):
+        atts = {}
+        for (name, value) in attributes.items():
+            atts[name.lower()] = value
+        for att in ('class',):          # append to node attribute
+            if node.has_key(att):
+                if atts.has_key(att):
+                    atts[att] = node[att] + ' ' + atts[att]
+        for att in ('id',):             # node attribute overrides
+            if node.has_key(att):
+                atts[att] = node[att]
+        attlist = atts.items()
+        attlist.sort()
+        parts = [tagname]
+        for name, value in attlist:
+            if value is None:           # boolean attribute
+                parts.append(name.lower())
+            elif isinstance(value, ListType):
+                values = [str(v) for v in value]
+                parts.append('%s="%s"' % (name.lower(),
+                                          self.encode(' '.join(values))))
+            else:
+                parts.append('%s="%s"' % (name.lower(),
+                                          self.encode(str(value))))
+        return '<%s>%s' % (' '.join(parts), suffix)
+
+    def visit_Text(self, node):
+        self.context.append('#text')
+        self.body.append(node.astext())
+
+    def depart_Text(self, node):
+        self.context.pop()
+
+    def visit_admonition(self, node, name):
+        pass
+
+    def depart_admonition(self):
+        pass
+
+    def visit_attention(self, node):
+        self.visit_admonition(node, 'attention')
+
+    def depart_attention(self, node):
+        self.depart_admonition()
+
+    def visit_author(self, node):
+        self.visit_docinfo_item(node, 'author')
+
+    def depart_author(self, node):
+        self.depart_docinfo_item()
+
+    def visit_address(self, node):
+        self.visit_docinfo_item(node, 'address')
+
+    def depart_address(self, node):
+        self.depart_docinfo_item()
+
+    def visit_version(self, node):
+        self.visit_docinfo_item(node, 'version')
+
+    def depart_version(self, node):
+        self.depart_docinfo_item()
+
+    def visit_system_message(self, node):
+        pass
+
+    def depart_system_message(self, node):
+        pass
+
+    def visit_term(self, node):
+        self.context.append('dt')
+        self.body.append(self.starttag(node, 'dt', ''))
+
+    def depart_term(self, node):
+        # Closes on visit_definition
+        self.context.pop()
+
+    def visit_authors(self, node):
+        pass
+
+    def depart_authors(self, node):
+        pass
+
+    def visit_block_quote(self, node):
+        pass
+
+    def depart_block_quote(self, node):
+        pass
+
+    def visit_bullet_list(self, node):
+        self.context.append(len(self.body))
+        self.context.append('ul')
+        self.body.append('<ul bulletText="%s">' % self.bulletText)
+
+    def depart_bullet_list(self, node):
+        self.context.pop()
+        self.body.append('</ul>')
+        start = self.context.pop()
+        if not 'ul' in self.context:
+            self.append_para(self.body[start:])
+            self.body = self.body[:start]
+
+    def visit_caption(self, node):
+        pass
+
+    def depart_caption(self, node):
+        pass
+
+    def visit_caution(self, node):
+        self.visit_admonition(node, 'caution')
+
+    def depart_caution(self, node):
+        self.depart_admonition()
+
+    def visit_citation(self, node):
+        pass
+
+    def depart_citation(self, node):
+        pass
+
+    def visit_citation_reference(self, node):
+        pass
+
+    def depart_citation_reference(self, node):
+        pass
+
+    def visit_classifier(self, node):
+        pass
+
+    def depart_classifier(self, node):
+        pass
+
+    def visit_colspec(self, node):
+        pass
+
+    def depart_colspec(self, node):
+        pass
+
+    def visit_contact(self, node):
+        self.visit_docinfo_item(node, 'contact')
+
+    def depart_contact(self, node):
+        self.depart_docinfo_item()
+
+    def visit_copyright(self, node):
+        self.visit_docinfo_item(node, 'copyright')
+
+    def depart_copyright(self, node):
+        self.depart_docinfo_item()
+
+    def visit_danger(self, node):
+        self.visit_admonition(node, 'danger')
+
+    def depart_danger(self, node):
+        self.depart_admonition()
+
+    def visit_date(self, node):
+        self.visit_docinfo_item(node, 'date')
+
+    def depart_date(self, node):
+        self.depart_docinfo_item()
+
+    def visit_definition(self, node):
+        self.body.append('</dt>')
+        self.context.append('dd')
+        self.body.append(self.starttag(node, 'dd'))
+
+    def depart_definition(self, node):
+        self.context.pop()
+        self.body.append('</dd>')
+
+    def visit_definition_list(self, node):
+        self.context.append(len(self.body))
+        self.context.append('dl')
+        self.body.append(self.starttag(node, 'dl'))
+
+    def depart_definition_list(self, node):
+        self.context.pop()
+        self.body.append('</dl>')
+        start = self.context.pop()
+        if not 'dl' in self.context:
+            self.append_para(self.body[start:])
+            self.body = self.body[:start]
+
+    def visit_definition_list_item(self, node):
+        pass
+
+    def depart_definition_list_item(self, node):
+        pass
+
+    def visit_description(self, node):
+        pass
+
+    def depart_description(self, node):
+        pass
+
+    def visit_docinfo(self, node):
+        self.context.append(len(self.body))
+        self.in_docinfo = 1
+
+    def depart_docinfo(self, node):
+        start = self.context.pop()
+        docinfo = self.body[start:]
+        self.body = self.body[:start]
+        self.append_para(docinfo)
+        self.in_docinfo = None
+
+    def visit_docinfo_item(self, node, name):
+        self.body.append('<para style="DocInfo"><b>%s: </b>' % self.language.labels[name])
+
+    def depart_docinfo_item(self):
+        self.body.append('</para>')
+
+    def visit_doctest_block(self, node):
+        self.visit_literal_block(node)
+
+    def depart_doctest_block(self, node):
+        self.depart_literal_block(node)
+
+    def visit_line_block(self, node):
+        self.visit_literal_block(node)
+
+    def depart_line_block(self, node):
+        self.depart_literal_block(node)
+
+    def visit_document(self, node):
+        pass
+
+    def depart_document(self, node):
+        pass
+
+    def visit_emphasis(self, node):
+        self.context.append('i')
+        self.body.append('<i>')
+
+    def depart_emphasis(self, node):
+        self.context.pop()
+        self.body.append('</i>')
+
+    def visit_entry(self, node):
+        pass
+
+    def depart_entry(self, node):
+        pass
+
+    def visit_enumerated_list(self, node):
+        self.context.append(len(self.body))
+        self.context.append('ol')
+        self.body.append('<ol>')
+
+    def depart_enumerated_list(self, node):
+        self.context.pop()
+        self.body.append('</ol>')
+        start = self.context.pop()
+        if not 'ol' in self.context:
+            self.append_para(self.body[start:])
+            self.body = self.body[:start]
+
+    def visit_error(self, node):
+        self.visit_admonition(node, 'error')
+
+    def depart_error(self, node):
+        self.depart_admonition()
+
+    def visit_field(self, node):
+        self.body.append('<para>')
+
+    def depart_field(self, node):
+        self.body.append('</para>')
+
+    def visit_field_argument(self, node):
+        pass
+
+    def depart_field_argument(self, node):
+        pass
+
+    def visit_field_list(self, node):
+        self.context.append(len(self.body))
+        self.body.append('<para>')
+
+    def depart_field_list(self, node):
+        start = self.context.pop()
+        self.body.append('</para>')
+        self.append_para(self.body[start:])
+        self.body = self.body[:start]
+
+    def visit_field_name(self, node):
+        self.body.append('<b>')
+
+    def depart_field_name(self, node):
+        self.body.append(': </b>')
+
+    def visit_field_body(self, node):
+        pass
+
+    def depart_field_body(self, node):
+        pass
+
+    def visit_footnote(self, node):
+        self.context.append('footnotes')
+        self.footnote_backrefs(node)
+
+    def footnote_backrefs(self, node):
+        if self.settings.footnote_backlinks and node.hasattr('backrefs'):
+            backrefs = node['backrefs']
+            if len(backrefs) == 1:
+                self.context.append("%s%s" % (self.starttag({}, 'setLink', '', destination=node['id']), \
+                                    '</setLink>'))
+                self.context.append("%s%s" % (self.starttag({}, 'link', '', destination=backrefs[0]), \
+                                    '</link>'))
+            else:
+                i = 1
+                backlinks = []
+                for backref in backrefs:
+                    backlinks.append("%s%s%s" % (self.starttag({}, 'link', '', destination=backref),
+                                                 i,
+                                                 '</link>'))
+                    i += 1
+                self.context.append(' <i>(%s)</i> ' % ', '.join(backlinks))
+                self.context.append("%s%s" % (self.starttag({}, 'setLink', '', destination=node['id']), \
+                                 '</setLink>'))
+        else:
+            self.context.append("%s%s" % (self.starttag({}, 'setLink', '', destination=node['id']), \
+                                '</setLink>'))
+            self.context.append('')
+
+    def footnote_backrefs_depart(self, node):
+        if not self.context and self.body:
+            self.append_para(self.body)
+            self.body = []
+
+    def depart_footnote(self, node):
+        self.context.pop()
+        self.footnote_backrefs_depart(node)
+
+    def visit_footnote_reference(self, node):
+        # for backrefs
+        if self.settings.footnote_backlinks and node.has_key('id'):
+            self.body.append(self.starttag(node, 'setLink', '', destination=node['id']))
+            self.context.append('</setLink>')
+        else:
+            self.context.append('')
+
+        href = ''
+        if node.has_key('refid'):
+            href = node['refid']
+        elif node.has_key('refname'):
+            href = self.document.nameids[node['refname']]
+        format = self.settings.footnote_references
+        if format == 'brackets':
+            suffix = '['
+            self.context.append(']')
+        elif format == 'superscript':
+            suffix = '<super>'
+            self.context.append('</super>')
+        else:                           # shouldn't happen
+            suffix = '???'
+            self.content.append('???')
+        self.body.append(self.starttag(node, 'link', suffix, destination=href))
+
+    def depart_footnote_reference(self, node):
+        self.body.append(self.context.pop())
+        self.body.append('</link>')
+        self.body.append(self.context.pop())
+
+    def visit_hint(self, node):
+        self.visit_admonition(node, 'hint')
+
+    def depart_hint(self, node):
+        self.depart_admonition()
+
+    def visit_image(self, node):
+        pass
+
+    def depart_image(self, node):
+        pass
+
+    def visit_important(self, node):
+        self.visit_admonition(node, 'important')
+
+    def depart_important(self, node):
+        self.depart_admonition()
+
+    def visit_interpreted(self, node):
+        pass
+
+    def depart_interpreted(self, node):
+        pass
+
+    def visit_label(self, node):
+        if 'footnotes' in self.context:
+            self.body.append('[')
+
+    def depart_label(self, node):
+        if 'footnotes' in self.context:
+            self.body.append(']')
+            self.body.append(self.context.pop())
+            self.body.append(self.context.pop())
+        self.body.append('   ')
+
+    def visit_legend(self, node):
+        pass
+
+    def depart_legend(self, node):
+        pass
+
+    def visit_list_item(self, node):
+        self.context.append('li')
+        self.body.append('<li>')
+
+    def depart_list_item(self, node):
+        self.context.pop()
+        self.body.append('</li>')
+
+    def visit_literal(self, node):
+        self.context.append('literal')
+
+    def depart_literal(self, node):
+        self.context.pop()
+
+    def visit_literal_block(self, node):
+        self.story.append(Preformatted(node.astext(), self.styleSheet['Code']))
+        raise nodes.SkipNode
+
+    def depart_literal_block(self, node):
+        pass
+
+    def visit_meta(self, node):
+        self.head.append(self.starttag(node, 'meta', **node.attributes))
+
+    def depart_meta(self, node):
+        pass
+
+    def visit_note(self, node):
+        self.visit_admonition(node, 'note')
+
+    def depart_note(self, node):
+        self.depart_admonition()
+
+    def visit_option(self, node):
+        pass
+
+    def depart_option(self, node):
+        pass
+
+    def visit_option_argument(self, node):
+        pass
+
+    def depart_option_argument(self, node):
+        pass
+
+    def visit_option_group(self, node):
+        pass
+
+    def depart_option_group(self, node):
+        pass
+
+    def visit_option_list(self, node):
+        self.context.append(len(self.body))
+        self.context.append('option_list')
+
+    def depart_option_list(self, node):
+        self.context.pop()
+        start = self.context.pop()
+        if not 'option_list' in self.context:
+            self.append_para(self.body[start:])
+            self.body = self.body[:start]
+
+    def visit_option_list_item(self, node):
+        pass
+
+    def depart_option_list_item(self, node):
+        pass
+
+    def visit_option_string(self, node):
+        pass
+
+    def depart_option_string(self, node):
+        pass
+
+    def visit_organization(self, node):
+        self.visit_docinfo_item(node, 'organization')
+
+    def depart_organization(self, node):
+        self.depart_docinfo_item()
+
+    def visit_paragraph(self, node):
+        self.context.append(len(self.body))
+        self.context.append('p')
+
+    def depart_paragraph(self, node):
+        self.context.pop()
+        start = self.context.pop()
+        if not self.context and self.body:
+            self.append_para(self.body[start:])
+            self.body = self.body[:start]
+
+    def visit_problematic(self, node):
+        pass
+
+    def depart_problematic(self, node):
+        pass
+
+    def visit_raw(self, node):
+        if node.has_key('format') and node['format'] == 'html':
+            self.body.append(node.astext())
+        raise nodes.SkipNode
+
+    def visit_target(self, node):
+        if not (node.has_key('refuri') or node.has_key('refid')
+                or node.has_key('refname')):
+            href = ''
+            if node.has_key('id'):
+                href = node['id']
+            elif node.has_key('name'):
+                href = node['name']
+            self.body.append("%s%s" % (self.starttag(node, 'setLink', '', destination=href), \
+                             '</setLink>'))
+        raise nodes.SkipNode
+
+    def depart_target(self, node):
+        pass
+
+    def visit_reference(self, node):
+        self.context.append('a')
+        if node.has_key('refuri'):
+            href = node['refuri']
+            self.body.append(self.starttag(node, 'a', '', href=href))
+            self.context.append('</a>')
+        else:
+            if node.has_key('id'):
+                self.body.append(self.starttag({}, 'setLink', '', destination=node['id']))
+                self.context.append('</setLink>')
+            if node.has_key('refid'):
+                href = node['refid']
+            elif node.has_key('refname'):
+                href = self.document.nameids[node['refname']]
+            self.body.append(self.starttag(node, 'link', '', destination=href))
+            self.context.append('</link>')
+
+    def depart_reference(self, node):
+        if node.has_key('id') and \
+           not node.has_key('refuri'):
+            self.body.append(self.context.pop())
+        self.body.append(self.context.pop())
+        self.context.pop()
+
+    def visit_revision(self, node):
+        self.visit_docinfo_item(node, 'revision')
+
+    def depart_revision(self, node):
+        self.depart_docinfo_item()
+
+    def visit_row(self, node):
+        pass
+
+    def depart_row(self, node):
+        pass
+
+    def visit_section(self, node):
+        self.sectionlevel += 1
+
+    def depart_section(self, node):
+        self.sectionlevel -= 1
+
+    def visit_status(self, node):
+        self.visit_docinfo_item(node, 'status')
+
+    def depart_status(self, node):
+        self.depart_docinfo_item()
+
+    def visit_strong(self, node):
+        self.context.append('b')
+        self.body.append('<b>')
+
+    def depart_strong(self, node):
+        self.context.pop()
+        self.body.append('</b>')
+
+    def visit_subtitle(self, node):
+        self.context.append(len(self.body))
+        self.context.append('subtitle')
+
+    def depart_subtitle(self, node):
+        style = self.context.pop()
+        start = self.context.pop()
+        self.append_para(self.body[start:], style)
+        self.body = self.body[:start]
+
+    def visit_title(self, node):
+        atts = {}
+        self.context.append(len(self.body))
+        self.context.append('title')
+        if isinstance(node.parent, nodes.topic):
+            self.context.append('')
+            self.topic_class = 'topic-title'
+        elif self.sectionlevel == 0:
+            self.context.append('title')
+        else:
+            self.context.append("h%s" % self.sectionlevel)
+
+        if self.context[-1] != 'title':
+            if node.parent.hasattr('id'):
+                self.context.append('</setLink>')
+                self.body.append(self.starttag({}, 'setLink', '', destination=node.parent['id']))
+            if node.hasattr('refid'):
+                self.context.append('</link>')
+                self.body.append(self.starttag({}, 'link', '', destination=node['refid']))
+        else:
+            self.context.append('')
+
+    def depart_title(self, node):
+        if node.hasattr('refid'):
+            self.body.append(self.context.pop())
+        if node.parent.hasattr('id'):
+            self.body.append(self.context.pop())
+        in_style = self.context.pop()
+        self.context.pop()
+        if isinstance(node.parent, nodes.topic):
+            in_style = self.topic_class
+        if not in_style:
+            in_style='Normal'
+        start = self.context.pop()
+        if not isinstance(start, int):
+            start = 0
+        self.append_para(self.body[start:], in_style)
+        self.body = self.body[:start]
+
+    def unimplemented_visit(self, node):
+        raise NotImplementedError('visiting unimplemented node type: %s'
+                                  % node.__class__.__name__)
+
+    def visit_topic(self, node):
+        if node.hasattr('id'):
+            self.context.append('</setLink>')
+            self.body.append(self.starttag({}, 'setLink', '', destination=node['id']))
+
+    def depart_topic(self, node):
+        if node.hasattr('id'):
+            self.body.append(self.context.pop())
+
+    def visit_generated(self, node):
+        pass
+
+    def depart_generated(self, node):
+        pass
+
+    def invisible_visit(self, node):
+        """Invisible nodes should be ignored."""
+        pass
+
+    def visit_comment(self, node):
+        raise nodes.SkipNode
+
+    depart_comment = invisible_visit
+    visit_substitution_definition = visit_comment
+    depart_substitution_definition = depart_comment
+    visit_figure = visit_comment
+    depart_figure = depart_comment
+
+    visit_sidebar = invisible_visit
+    visit_warning = invisible_visit
+    visit_tip = invisible_visit
+    visit_tbody = invisible_visit
+    visit_thead = invisible_visit
+    visit_tgroup = invisible_visit
+    visit_table = invisible_visit
+    visit_title_reference = invisible_visit
+    visit_transition = invisible_visit
+    visit_pending = invisible_visit
+    depart_pending = invisible_visit
+    depart_transition = invisible_visit
+    depart_title_reference = invisible_visit
+    depart_table = invisible_visit
+    depart_tgroup = invisible_visit
+    depart_thead = invisible_visit
+    depart_tbody = invisible_visit
+    depart_tip = invisible_visit
+    depart_warning = invisible_visit
+    depart_sidebar = invisible_visit


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rlpdf.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rltemplate.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rltemplate.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rltemplate.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,144 @@
+# -*- coding: utf-8 -*-
+#copyright ReportLab Inc. 2000
+#see rllicense.txt for license details
+#history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/docs/tools/rltemplate.py?cvsroot=reportlab
+#$Header: /cvsroot/docutils/sandbox/dreamcatcher/rlpdf/rltemplate.py,v 1.1 2003/05/02 13:57:01 dreamcatcher Exp $
+# doc template for RL manuals.  Currently YAML is hard-coded
+#to use this, which is wrong.
+
+
+from reportlab.platypus import PageTemplate, \
+     BaseDocTemplate, SimpleDocTemplate, Frame, Paragraph
+from reportlab.lib.units import inch, cm
+from reportlab.rl_config import defaultPageSize
+
+
+class FrontCoverTemplate(PageTemplate):
+    def __init__(self, id, pageSize=defaultPageSize):
+        self.pageWidth = pageSize[0]
+        self.pageHeight = pageSize[1]
+        frame1 = Frame(inch,
+                       3*inch,
+                       self.pageWidth - 2*inch,
+                       self.pageHeight - 518, id='cover')
+        PageTemplate.__init__(self, id, [frame1])  # note lack of onPage
+
+    def afterDrawPage(self, canvas, doc):
+        canvas.saveState()
+        #canvas.drawImage('../images/replogo.gif',2*inch, 8*inch)
+
+
+        canvas.setFont('Times-Roman', 10)
+        canvas.line(inch, 120, self.pageWidth - inch, 120)
+
+        #canvas.drawString(inch, 100, 'Lombard Business Park')
+        #canvas.drawString(inch, 88, '8 Lombard Road')
+        #canvas.drawString(inch, 76, 'Wimbledon')
+        #canvas.drawString(inch, 64, 'London, ENGLAND SW19 3TZ')
+
+        #canvas.drawRightString(self.pageWidth - inch, 100, '103 Bayard Street')
+        #canvas.drawRightString(self.pageWidth - inch, 88, 'New Brunswick')
+        #canvas.drawRightString(self.pageWidth - inch, 76, 'New Jersey, 08904)')
+        #canvas.drawRightString(self.pageWidth - inch, 64, 'USA')
+
+        canvas.restoreState()
+
+
+class OneColumnTemplate(PageTemplate):
+    def __init__(self, id, pageSize=defaultPageSize):
+        self.pageWidth = pageSize[0]
+        self.pageHeight = pageSize[1]
+        frame1 = Frame(inch,
+                       inch,
+                       self.pageWidth - 2*inch,
+                       self.pageHeight - 2*inch,
+                       id='normal')
+        PageTemplate.__init__(self, id, [frame1])  # note lack of onPage
+
+    def afterDrawPage(self, canvas, doc):
+        y = self.pageHeight - 50
+        canvas.saveState()
+        canvas.setFont('Times-Roman', 10)
+        canvas.drawString(inch, y+8, doc.title)
+        canvas.drawRightString(self.pageWidth - inch, y+8, doc.chapter)
+        canvas.line(inch, y, self.pageWidth - inch, y)
+        canvas.drawCentredString(doc.pagesize[0] / 2, 0.75*inch, 'Page %d' % canvas.getPageNumber())
+        canvas.restoreState()
+
+class TwoColumnTemplate(PageTemplate):
+    def __init__(self, id, pageSize=defaultPageSize):
+        self.pageWidth = pageSize[0]
+        self.pageHeight = pageSize[1]
+        colWidth = 0.5 * (self.pageWidth - 2.25*inch)
+        frame1 = Frame(inch,
+                       inch,
+                       colWidth,
+                       self.pageHeight - 2*inch,
+                       id='leftCol')
+        frame2 = Frame(0.5 * self.pageWidth + 0.125,
+                       inch,
+                       colWidth,
+                       self.pageHeight - 2*inch,
+                       id='rightCol')
+        PageTemplate.__init__(self, id, [frame1, frame2])  # note lack of onPage
+
+    def afterDrawPage(self, canvas, doc):
+        y = self.pageHeight - 50
+        canvas.saveState()
+        canvas.setFont('Times-Roman', 10)
+        canvas.drawString(inch, y+8, doc.title)
+        canvas.drawRightString(self.pageWidth - inch, y+8, doc.chapter)
+        canvas.line(inch, y, self.pageWidth - inch, y*inch)
+        canvas.drawCentredString(doc.pagesize[0] / 2, 0.75*inch, 'Page %d' % canvas.getPageNumber())
+        canvas.restoreState()
+
+
+# class RLDocTemplate(BaseDocTemplate):
+class RLDocTemplate(SimpleDocTemplate):
+    def afterInit(self):
+        self.addPageTemplates(FrontCoverTemplate('Cover', self.pagesize))
+        self.addPageTemplates(OneColumnTemplate('Normal', self.pagesize))
+        self.addPageTemplates(TwoColumnTemplate('TwoColumn', self.pagesize))
+        self.addPageTemplates(OneColumnTemplate('Cover', self.pagesize))
+
+        #just playing
+        self.title = "(Document Title Goes Here)"
+        self.chapter = "(No chapter yet)"
+        self.chapterNo = 1 #unique keys
+        self.sectionNo = 1 # unique keys
+
+##        # AR hack
+##        self.counter = 1
+    def beforeDocument(self):
+        self.canv.showOutline()
+
+    def afterFlowable(self, flowable):
+        """Detect Level 1 and 2 headings, build outline,
+        and track chapter title."""
+        if isinstance(flowable, Paragraph):
+            style = flowable.style.name
+
+##            #AR debug text
+##            try:
+##                print '%d: %s...' % (self.counter, flowable.getPlainText()[0:40])
+##            except AttributeError:
+##                print '%d: (something with ABag)' % self.counter
+##            self.counter = self.counter + 1
+
+            if style == 'Title':
+                self.title = flowable.getPlainText()
+            elif style == 'Heading1':
+                self.chapter = flowable.getPlainText()
+                key = 'ch%d' % self.chapterNo
+                self.canv.bookmarkPage(key)
+                self.canv.addOutlineEntry(flowable.getPlainText(),
+                                            key, 0, 0)
+                self.chapterNo = self.chapterNo + 1
+                self.sectionNo = 1
+            elif style == 'Heading2':
+                self.section = flowable.text
+                key = 'ch%ds%d' % (self.chapterNo, self.sectionNo)
+                self.canv.bookmarkPage(key)
+                self.canv.addOutlineEntry(flowable.getPlainText(),
+                                             key, 1, 0)
+                self.sectionNo = self.sectionNo + 1


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/rltemplate.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/stylesheet.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/stylesheet.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/stylesheet.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,215 @@
+# -*- coding: utf-8 -*-
+#copyright ReportLab Inc. 2000
+#see rllicense.txt for license details
+#history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/docs/tools/stylesheet.py?cvsroot=reportlab
+#$Header: /cvsroot/docutils/sandbox/dreamcatcher/rlpdf/stylesheet.py,v 1.2 2003/05/05 02:23:49 dreamcatcher Exp $
+#standard stylesheet for our manuals
+
+
+from reportlab.lib.styles import StyleSheet1, ParagraphStyle
+from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT, TA_JUSTIFY
+from reportlab.lib import colors
+
+
+def getStyleSheet():
+    """Returns a stylesheet object"""
+    stylesheet = StyleSheet1()
+
+    stylesheet.add(ParagraphStyle(name='Normal',
+                                  fontName='Times-Roman',
+                                  fontSize=10,
+                                  leading=12,
+                                  spaceBefore=4,
+                                  spaceAfter=4)
+                   )
+
+    stylesheet.add(ParagraphStyle(name='DocInfo',
+                                  parent=stylesheet['Normal'],
+                                  leading=12,
+                                  spaceBefore=0,
+                                  spaceAfter=0)
+                   )
+
+    stylesheet.add(ParagraphStyle(name='Comment',
+                                  fontName='Times-Italic')
+                   )
+
+    stylesheet.add(ParagraphStyle(name='Indent1',
+                                  leftIndent=36,
+                                  firstLineIndent=0)
+                   )
+    
+    stylesheet.add(ParagraphStyle(name='BodyText',
+                                  parent=stylesheet['Normal'],
+                                  spaceBefore=6)
+                   )
+    stylesheet.add(ParagraphStyle(name='Italic',
+                                  parent=stylesheet['BodyText'],
+                                  fontName = 'Times-Italic')
+                   )
+
+    stylesheet.add(ParagraphStyle(name='Heading1',
+                                  parent=stylesheet['Normal'],
+                                  fontName = 'Times-Bold',
+                                  fontSize=20,
+                                  leading=20,
+                                  spaceBefore=10,
+                                  spaceAfter=6),
+                   alias='h1')
+
+    stylesheet.add(ParagraphStyle(name='Heading2',
+                                  parent=stylesheet['Normal'],
+                                  fontName = 'Times-Bold',
+                                  fontSize=18,
+                                  leading=18,
+                                  spaceBefore=10,
+                                  spaceAfter=6),
+                   alias='h2')
+    
+    stylesheet.add(ParagraphStyle(name='Heading3',
+                                  parent=stylesheet['Normal'],
+                                  fontName = 'Times-BoldItalic',
+                                  fontSize=16,
+                                  leading=16,
+                                  spaceBefore=10,
+                                  spaceAfter=6),
+                   alias='h3')
+
+    stylesheet.add(ParagraphStyle(name='Heading4',
+                                  parent=stylesheet['Normal'],
+                                  fontName = 'Times-BoldItalic',
+                                  fontsize=14,
+                                  leading=14,
+                                  spaceBefore=8,
+                                  spaceAfter=4),
+                   alias='h4')
+
+    stylesheet.add(ParagraphStyle(name='Heading5',
+                                  parent=stylesheet['Normal'],
+                                  fontName = 'Times-BoldItalic',
+                                  fontsize=13,
+                                  leading=13,
+                                  spaceBefore=8,
+                                  spaceAfter=4),
+                   alias='h5')
+
+    stylesheet.add(ParagraphStyle(name='Heading6',
+                                  parent=stylesheet['Normal'],
+                                  fontName = 'Times-BoldItalic',
+                                  fontsize=12,
+                                  leading=12,
+                                  spaceBefore=8,
+                                  spaceAfter=4),
+                   alias='h6')
+
+    stylesheet.add(ParagraphStyle(name='Title',
+                                  parent=stylesheet['Normal'],
+                                  fontName = 'Times-Bold',
+                                  fontSize=22,
+                                  leading=22,
+                                  spaceAfter=8,
+                                  alignment=TA_CENTER
+                                  ),
+                   alias='title')
+
+    stylesheet.add(ParagraphStyle(name='Subtitle',
+                                  parent=stylesheet['Normal'],
+                                  fontName = 'Times-Bold',
+                                  fontSize=20,
+                                  leading=20,
+                                  spaceAfter=6,
+                                  alignment=TA_CENTER
+                                  ),
+                   alias='subtitle')
+
+    stylesheet.add(ParagraphStyle(name='TopicTitle',
+                                  parent=stylesheet['Normal'],
+                                  fontName = 'Times-Bold',
+                                  fontSize=18,
+                                  leading=14,
+                                  spaceAfter=6,
+                                  ),
+                   alias='topic-title')
+
+    for i in range(0, 15):
+        indent = 18*i
+        stylesheet.add(ParagraphStyle(name='TopicItem%s' % i,
+                                  parent=stylesheet['Normal'],
+                                  fontName = 'Times-Roman',
+                                  fontSize=12,
+                                  leftIndent=indent,
+                                  spaceBefore=0,
+                                  spaceAfter=0,
+                                  ),
+                   alias='topic-item-%s' % i)
+
+    stylesheet.add(ParagraphStyle(name='UnorderedList',
+                                  parent=stylesheet['Normal'],
+                                  firstLineIndent=0,
+                                  leftIndent=18,
+                                  bulletIndent=9,
+                                  spaceBefore=0,
+                                  bulletFontName='Symbol'),
+                   alias='ul')
+
+    stylesheet.add(ParagraphStyle(name='Definition',
+                                  parent=stylesheet['Normal'],
+                                  firstLineIndent=0,
+                                  leftIndent=36,
+                                  bulletIndent=0,
+                                  spaceAfter=2,
+                                  spaceBefore=2,
+                                  bulletFontName='Times-BoldItalic'),
+                   alias='dl')
+
+    stylesheet.add(ParagraphStyle(name='OrderedList',
+                                  parent=stylesheet['Definition']),
+                   alias='ol')
+
+    stylesheet.add(ParagraphStyle(name='Code',
+                                  parent=stylesheet['Normal'],
+                                  fontName='Courier',
+                                  textColor=colors.navy,
+                                  fontSize=8,
+                                  leading=8.8,
+                                  leftIndent=36,
+                                  firstLineIndent=0))
+
+    stylesheet.add(ParagraphStyle(name='FunctionHeader',
+                                  parent=stylesheet['Normal'],
+                                  fontName='Courier-Bold',
+                                  fontSize=8,
+                                  leading=8.8))
+
+    stylesheet.add(ParagraphStyle(name='DocString',
+                                  parent=stylesheet['Normal'],
+                                  fontName='Courier',
+                                  fontSize=8,
+                                  leftIndent=18,
+                                  leading=8.8))
+
+    stylesheet.add(ParagraphStyle(name='DocStringIndent',
+                                  parent=stylesheet['Normal'],
+                                  fontName='Courier',
+                                  fontSize=8,
+                                  leftIndent=36,
+                                  leading=8.8))
+
+    stylesheet.add(ParagraphStyle(name='URL',
+                                  parent=stylesheet['Normal'],
+                                  fontName='Courier',
+                                  textColor=colors.navy,
+                                  alignment=TA_CENTER),
+                   alias='u')
+ 
+    stylesheet.add(ParagraphStyle(name='Centred',
+                                  parent=stylesheet['Normal'],
+                                  alignment=TA_CENTER
+                                  ))
+
+    stylesheet.add(ParagraphStyle(name='Caption',
+                                  parent=stylesheet['Centred'],
+                                  fontName='Times-Italic'
+                                  ))
+    
+    return stylesheet


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rlpdf/stylesheet.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rml.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/rml.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/rml.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+###############################################################################
+"""RML-to-PDF View
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from StringIO import StringIO
+from zope.publisher.browser import BrowserPage
+from z3c.pdftemplate import trml2pdf
+
+
+class ResourceHandler:
+    """Wrapper to allow loading from external resources.
+
+    The implementation forbids local file access for security reasons.
+    """
+
+    def get(self, url, data=None):
+        url = str(url)
+        if url.startswith('file:'):
+            raise urllib2.URLError, \
+                  'The file: protocol is disabled for security'
+        fd = self.opener.open(url, data)
+        return StringIO(fd.read())
+
+class PDFTemplateGenerator(object):
+
+    template = None
+
+    def getPDFTemplate(self):
+        return self.template(self).encode('iso-8859-1')
+
+class RML2PDFView(PDFTemplateGenerator, BrowserPage):
+
+    document = None
+
+    def __call__(self):
+
+        rmldocument = self.document(self).encode('iso-8859-1')
+
+        self.request.response.setHeader('content-type', 'application/pdf')
+
+        return trml2pdf.parseString(rmldocument)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/rml.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/bopplogo.gif
===================================================================
(Binary files differ)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/bopplogo.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/box.gif
===================================================================
(Binary files differ)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/box.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/dcolner.gif
===================================================================
(Binary files differ)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/dcolner.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/devis.rml
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/devis.rml	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/devis.rml	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
+<!DOCTYPE document SYSTEM "rml_1_0.dtd">
+<document filename="example_5.pdf">
+<template pageSize="(21cm, 29.7cm)" leftMargin="2.0cm" rightMargin="2.0cm"
+  topMargin="2.0cm" bottomMargin="2.0cm" title="test" author="test" allowSplitting="20">
+    <pageTemplate id="first">
+        <pageGraphics>
+            <lines>2cm 3.2cm 19cm 3.2cm</lines>
+            <drawCentredString x="105mm" y="3.4cm">www.printbox.be - 0477/76.18.56 - printbox.be</drawCentredString>
+            <drawCentredString x="105mm" y="2.6cm">Tiny SPRL - rue Joseph Mathieu, 28 - B-1300 Limal - BELGIQUE - info at tiny.be</drawCentredString>
+            <drawCentredString x="105mm" y="2.0cm">RCN 95656 - TVA BE477.472.701 - IBAN: BE74 1262 0132 6907 - SWIFT: ARTEBEBB</drawCentredString>
+            <image x="23mm" y="23cm" file="pict/devis_logo.jpg"/>
+
+            <setFont name="Helvetica" size="135"/>
+            <fill color="(1,0.9,0.9)"/>
+            <stroke color="(1,0.9,0.9)"/>
+            <translate dx="15cm" dy="-5.5cm"/>
+            <rotate degrees="50"/>
+            <drawString x="23mm" y="12.7cm">DRAFT</drawString>
+            <lineMode width="5mm"/>
+            <rect round="1cm" x="18mm" y="12.2cm" width="17cm" height="5cm" fill="no" stroke="yes"/>
+
+        </pageGraphics>
+        <frame id="address" x1="11.2cm" y1="21.0cm" width="8cm" height="4.2cm"/>
+        <frame id="column" x1="2.0cm" y1="7.0cm" width="17cm" height="14cm"/>
+    </pageTemplate>
+</template>
+<stylesheet>
+    <blockTableStyle id="products">
+         <blockFont name="Helvetica-BoldOblique" size="24" start="0,0" stop="-1,0"/>
+         <blockBackground colorName="grey" start="0,0" stop="-1,0"/>
+         <blockTextColor colorName="white" start="0,0" stop="-1,0"/>
+         <blockValign value="TOP"/>
+         <blockAlignment value="RIGHT" start="1,0" stop="-1,-1"/>
+         <blockAlignment value="RIGHT" start="0,-3" stop="-1,-1"/>
+         <lineStyle kind="LINEBELOW" colorName="black" start="0,0" stop="-1,0"/>
+         <lineStyle kind="LINEABOVE" colorName="black" start="-1,-3" stop="-1,-3"/>
+         <lineStyle kind="LINEABOVE" colorName="black" start="-1,-1" stop="-1,-1"/>
+         <lineStyle kind="LINEBELOW" colorName="black" start="-1,-1" stop="-1,-1"/>
+         <lineStyle kind="LINEBEFORE" colorName="black" start="-1,-1" stop="-1,-1"/>
+         <lineStyle kind="LINEAFTER" colorName="black" start="-1,-1" stop="-1,-1"/>
+         <blockBackground colorName="(0.85,0.85,0.85)" start="-1,-1" stop="-1,-1"/>
+    </blockTableStyle>
+    <paraStyle name="conditions" fontName="Helvetica" fontSize="8" alignment="justify"/>
+</stylesheet>
+<story>
+    <xpre><b>Fabien Pinckaers</b>
+Rue Joseph Mathieu 28
+1300 Limal
+Tel: <i>010.68.94.39</i>
+    </xpre>
+    <nextFrame/>
+    <para>
+        <b>Document</b>: <i>Devis impression sur textile</i>
+    </para>
+    <spacer length="1cm" width="1mm"/>
+    <para>
+        Madame, Monsieur,
+    </para>
+    <spacer length="5mm" width="1mm"/>
+    <para>
+        Vous trouverez ci-join le devis suite a votre demande faite sur notre site.
+    </para>
+    <spacer length="1cm" width="1mm"/>
+    <blockTable colWidths="10cm,2.2cm,1.0cm,2.5cm" style="products">
+    <tr>
+        <td>Description</td><td>Prix Unit.</td><td>Qty</td><td>Prix HTVA</td>
+    </tr><tr>
+        <td>Chemises</td><td>23.00</td><td>32</td> <td>345.00</td>
+    </tr><tr>
+        <td>T-shirts</td><td>23.00</td><td>32</td> <td>345.00</td>
+    </tr><tr>
+        <td>HTVA:</td><td/><td/><td>100.00</td>
+    </tr><tr>
+        <td>TVA:</td><td/><td/><td>20.00</td>
+    </tr><tr>
+        <td>TVAC:</td><td/><td/><td>120.00</td>
+    </tr>
+    </blockTable>
+    <spacer length="1cm" width="1mm"/>
+    <para style="conditions">
+        Tout acceptation de ce devis necessite le <b>renvoi de ce dernier</b> apres avoir ete date et signe et
+        suivi des mentions suivantes : <i>"lu et approuve"</i> et <i>"bon pour accord"</i>.
+    </para>
+    <spacer length="0.5cm" width="1mm"/>
+    <para style="conditions">
+        <b>Tout contrat conclu avec notre societe est exclusivement regi par nos
+        conditions generales.</b>
+    </para>
+</story>
+</document>

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/devis_logo.jpg
===================================================================
(Binary files differ)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/devis_logo.jpg
___________________________________________________________________
Name: svn:mime-type
   + image/jpeg

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/dot_blue.gif
===================================================================
(Binary files differ)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/dot_blue.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/dot_red.gif
===================================================================
(Binary files differ)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/dot_red.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex01.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex01.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex01.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="sample.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Sample 01" 
+        author="me" 
+        showBoundary="0" 
+        > 
+		<pageTemplate id="main">
+		<frame id="first" x1="72" y1="72" width="451" height="698"/>
+		</pageTemplate>
+</template>
+<stylesheet>
+</stylesheet>
+<story>
+		<para>
+			Hello World.
+		</para>
+</story>
+</document>
\ No newline at end of file


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex01.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex02.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex02.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex02.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="sample.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+		<pageTemplate id="main">
+		<frame id="first" x1="72" y1="72" width="451" height="698"/>
+		</pageTemplate>
+</template>
+<stylesheet>
+</stylesheet>
+<!-- The story starts below this comment -->
+<story>
+		<para>
+			This is the "story". This is the part of the RML document where
+			your text is placed.
+		</para>
+		<para>
+			It should be enclosed in "para" and "/para" tags to turn it into
+			paragraphs.
+		</para>
+</story>
+</document>
+


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex02.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex03.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex03.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex03.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="sample.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        >
+	<pageTemplate id="main">
+	<pageGraphics>
+		<!-- set the font and fill colour for the title. -->
+		<fill color="red"/>
+		<setFont name="Helvetica" size="24"/>
+		<!-- Use drawCentredString to place a title on the page -->
+		<drawCentredString x="297.5" y="800">
+			Simple Text and Graphics with RML.
+		</drawCentredString>
+		<fill color="red"/>
+		<!-- look at the output - though a fill color is set, no fill -->
+		<!-- is produced, since fill is set to "no" for the circle	-->
+		<circle x="127.5" y="672.75" radius="1 in" fill="no" stroke="yes"/>
+		<fill color="green"/>
+		<stroke color="black"/>
+		<circle x="297.5" y="672.75" radius="1 in" fill="yes" stroke="no"/>
+		<fill color="blue"/>
+		<stroke color="black"/>
+		<circle x="467.5" y="672.75" radius="1 in" fill="yes" stroke="yes"/>
+		<fill color="black"/>
+		<setFont name="Helvetica" size="9"/>
+		<drawCentredString x="127.5" y="567.5">
+			Circle - with stroke, but no fill.
+		</drawCentredString>
+		<drawCentredString x="297.5" y="567.5">
+			Circle - with fill, but no stroke.
+		</drawCentredString>
+		<drawCentredString x="467.5" y="567.5">
+			Circle - with both stroke and fill.
+		</drawCentredString>
+		<fill color="red"/>
+		<ellipse x="77" y="382.25" width="177" height="552.25" fill="no" stroke="yes"/>
+		<fill color="green"/>
+		<stroke color="black"/>
+		<ellipse x="247" y="382.25" width="347" height="552.25" fill="yes" stroke="no"/>
+		<fill color="blue"/>
+		<stroke color="black"/>
+		<ellipse x="417" y="382.25" width="507" height="552.25" fill="yes" stroke="yes"/>
+		<fill color="black"/>
+		<drawCentredString x="127.5" y="357">
+			Ellipse - with stroke, but no fill.
+		</drawCentredString>
+		<drawCentredString x="297.5" y="357">
+			Ellipse - with fill, but no stroke.
+		</drawCentredString>
+		<drawCentredString x="467.5" y="357">
+			Ellipse - with both stroke and fill.
+		</drawCentredString>
+		<rect x="84.5" y="214.3" width="1 in" height="1.15 in" fill="no" stroke="yes"/>
+		<fill color="green"/>
+		<stroke color="black"/>
+		<rect x="254.5" y="214.3" width="1 in" height="1.15 in" fill="yes" stroke="no"/>
+		<fill color="blue"/>
+		<stroke color="black"/>
+		<rect x="424.5" y="214.3" width="1 in" height="1.15 in" fill="yes" stroke="yes"/>
+		<fill color="black"/>
+		<drawCentredString x="127.5" y="199.1">
+			Rect - with stroke, but no fill.
+		</drawCentredString>
+		<drawCentredString x="297.5" y="199.1">
+			Rect - with fill, but no stroke.
+		</drawCentredString>
+		<drawCentredString x="467.5" y="199.1">
+			Rect - with both stroke and fill.
+		</drawCentredString>
+		<rect x="84.5" y="56.5" width="1 in" height="1.15 in" fill="no" stroke="yes" round="0.15 in"/>
+		<fill color="green"/>
+		<stroke color="black"/>
+		<rect x="254.5" y="56.5" width="1 in" height="1.15 in"
+			fill="yes" stroke="no" round="0.15 in"/>
+		<fill color="blue"/>
+		<stroke color="black"/>
+		<rect x="424.5" y="56.5" width="1 in" height="1.15 in"
+			fill="yes" stroke="yes" round="0.15 in"/>
+		<fill color="black"/>
+		<drawCentredString x="127.5" y="41.25">
+			Rect - with stroke and round, but no fill.
+		</drawCentredString>
+		<drawCentredString x="297.5" y="41.25">
+			Rect - with fill and round, but no stroke.
+		</drawCentredString>
+		<drawCentredString x="467.5" y="41.25">
+			Rect - with stroke, fill and round.
+		</drawCentredString>
+	</pageGraphics>
+	<frame id="first" x1="0.5in" y1="0.5in" width="20cm"
+			height="28cm"/>
+	</pageTemplate>
+</template>
+<stylesheet>
+</stylesheet>
+<story>
+<para></para>
+</story>
+</document>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex03.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex04.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex04.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex04.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="sample.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+		 <pageTemplate id="main">
+		 <pageGraphics>
+					<fill color="red"/>
+					<setFont name="Helvetica" size="24"/>
+					<drawCentredString x="297.5" y="800">
+							 Lines in RML.
+					</drawCentredString>
+					<!-- notice that each of these "empty" tags are teminated -->
+					<!-- with a slash -->
+					<lineMode width="1"/>
+					<lines>1in 10.5in 2in 10.5in
+					2in 10.5in 1.5in 10in
+					1.5in 10in 1.5in 10.75in
+					</lines>
+					<fill color="black"/>
+					<setFont name="Helvetica" size="9"/>
+					<drawCentredString x="1.5 in" y="9.75 in">
+							 width=1
+					</drawCentredString>
+					<lineMode width="5"/>
+					<lines>2.5in 10.5in 3.5in 10.5in
+					3.5in 10.5in 3in 10in
+					3in 10in 3in 10.75in
+					</lines>
+					<drawCentredString x="3 in" y="9.75 in">
+							 width=5
+					</drawCentredString>
+					<lineMode width="10"/>
+					<lines>4in 10.5in 5in 10.5in
+					5in 10.5in 4.5in 10in
+					4.5in 10in 4.5in 10.75in
+					</lines>
+					<drawCentredString x="4.5 in" y="9.75 in">
+							 width=10
+</drawCentredString>
+<lineMode width="15"/>
+<lines>5.5in 10.5in 6.5in 10.5in
+6.5in 10.5in 6in 10in
+6in 10in 6in 10.75in
+</lines>
+<drawCentredString x="6 in" y="9.75 in">
+		width=15
+</drawCentredString>
+<!-- examples for the 'join' attribute to 'LineMode' -->
+<lineMode width="5"/>
+<lines>1in 9in 2in 9in
+2in 9in 1.5in 8.5in
+1.5in 8.5in 1.5in 9.25in
+</lines>
+<fill color="black"/>
+<setFont name="Helvetica" size="9"/>
+<drawCentredString x="1.5 in" y="8.25 in">
+		width=10
+</drawCentredString>
+<!-- options for 'join' are "round", "mitered", or "bevelled" -->
+<lineMode width="5" join="round"/>
+<lines>2.5in 9in 3.5in 9in
+3.5in 9in 3in 8.5in
+3in 8.5in 3in 9.25in
+</lines>
+<drawCentredString x="3 in" y="8.25 in">
+		width=5, join=round
+</drawCentredString>
+<lineMode width="5" join="mitered"/>
+<lines>4in 9in 5in 9in
+5in 9in 4.5in 8.5in
+4.5in 8.5in 4.5in 9.25in
+</lines>
+<drawCentredString x="4.5 in" y="8.25 in">
+		width=5, join=mitered
+</drawCentredString>
+<lineMode width="5" join="bevelled"/>
+<lines>5.5in 9in 6.5in 9in
+6.5in 9in 6in 8.5in
+6in 8.5in 6in 9.25in
+</lines>
+<drawCentredString x="6 in" y="8.25 in">
+		width=5, join=bevelled
+</drawCentredString>
+<!-- examples for the 'cap' attribute to 'LineMode' -->
+<lineMode width="10"/>
+<lines>1in 7.5in 2in 7.5in
+2in 7.5in 1.5in 7in
+1.5in 7in 1.5in 7.75in
+</lines>
+<fill color="black"/>
+<setFont name="Helvetica" size="9"/>
+<drawCentredString x="1.5 in" y="6.75 in">
+		width=10
+</drawCentredString>
+<!-- options for 'cap' are "default", "round", or "square" -->
+<lineMode width="10" cap="default"/>
+<lines>2.5in 7.5in 3.5in 7.5in
+3.5in 7.5in 3in 7in
+3in 7in 3in 7.75in
+</lines>
+<drawCentredString x="3 in" y="6.75 in">
+		width=10, cap=default
+</drawCentredString>
+<lineMode width="10" cap="round"/>
+<lines>4in 7.5in 5in 7.5in
+5in 7.5in 4.5in 7in
+4.5in 7in 4.5in 7.75in
+</lines>
+<drawCentredString x="4.5 in" y="6.75 in">
+		width=10, cap=round
+</drawCentredString>
+<lineMode width="10" cap="square"/>
+<lines>5.5in 7.5in 6.5in 7.5in
+6.5in 7.5in 6in 7in
+6in 7in 6in 7.75in
+</lines>
+<drawCentredString x="6 in" y="6.75 in">
+		width=10, cap=square
+</drawCentredString>
+<lineMode width="5" cap="default"/>
+<!-- examples for the 'miterLimit' attribute to 'LineMode' -->
+<lineMode width="5" join="mitered"/>
+<lines>1in 6in 2in 6in
+2in 6in 1.5in 5.5in
+1.5in 5.5in 1.5in 6.25in
+</lines>
+<fill color="black"/>
+<setFont name="Helvetica" size="9"/>
+<drawCentredString x="1.5 in" y="5.25 in">
+		width=5, join=mitered
+</drawCentredString>
+<lineMode width="5" join="mitered" miterLimit="10"/>
+<lines>2.5in 6in 3.5in 6in
+3.5in 6in 3in 5.5in
+3in 5.5in 3in 6.25in
+</lines>
+<drawCentredString x="3 in" y="5.25 in">
+		width=5, join=mitered
+</drawCentredString>
+<drawCentredString x="3 in" y="5.1 in">
+		miterLimit=10
+</drawCentredString>
+<lineMode width="10" join="mitered"/>
+<lines>4in 6in 5in 6in
+5in 6in 4.5in 5.5in
+4.5in 5.5in 4.5in 6.25in
+</lines>
+<drawCentredString x="4.5 in" y="5.25 in">
+		width=10, join=mitered
+</drawCentredString>
+<lineMode width="10" join="mitered" miterLimit="20"/>
+<lines>5.5in 6in 6.5in 6in
+6.5in 6in 6in 5.5in
+6in 5.5in 6in 6.25in
+</lines>
+<drawCentredString x="6 in" y="5.25 in">
+		width=10, join=mitered
+</drawCentredString>
+				 <drawCentredString x="6 in" y="5.1 in">
+						 miterLimit=20
+				 </drawCentredString>
+				 <!-- examples for the 'dash' attribute to 'LineMode' -->
+				 <lineMode width="2"/>
+				 <lines>1in 4.5in 2in 4.5in
+				 2in 4.5in 1.5in 4in
+				 1.5in 4in 1.5in 4.75in
+				 </lines>
+				 <fill color="black"/>
+				 <setFont name="Helvetica" size="9"/>
+				 <drawCentredString x="1.5 in" y="3.75 in">
+						 width=2
+				 </drawCentredString>
+				 <!-- options for 'dash' are sequences of numbers -->
+				 <lineMode width="2" dash="5,5"/>
+				 <lines>2.5in 4.5in 3.5in 4.5in
+				 3.5in 4.5in 3in 4in
+				 3in 4in 3in 4.75in
+				 </lines>
+				 <drawCentredString x="3 in" y="3.75 in">
+						 width=2, dash=5,5
+				 </drawCentredString>
+				 <lineMode width="2" dash="2,10"/>
+				 <lines>4in 4.5in 5in 4.5in
+				 5in 4.5in 4.5in 4in
+				 4.5in 4in 4.5in 4.75in
+				 </lines>
+				 <drawCentredString x="4.5 in" y="3.75 in">
+						 width=2, dash=2,10
+				 </drawCentredString>
+				 <lineMode width="2" dash="5,5,2,10"/>
+				 <lines>5.5in 4.5in 6.5in 4.5in
+				 6.5in 4.5in 6in 4in
+				 6in 4in 6in 4.75in
+				 </lines>
+				 <drawCentredString x="6 in" y="3.75 in">
+						 width=2, dash=5,5,2,10
+				 </drawCentredString>
+		 </pageGraphics>
+		 <frame id="first" x1="72" y1="72" width="451" height="698"/>
+		 </pageTemplate>
+</template>
+<stylesheet>
+</stylesheet>
+<story>
+<para></para>
+</story>
+</document>
+


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex04.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex05.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex05.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex05.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
+<!DOCTYPE document SYSTEM "rml_1_0.dtd">
+<document filename="example_5.pdf">
+<template pageSize="(21cm, 29.7cm)"
+          leftMargin="2.5cm"
+          rightMargin="2.5cm"
+          topMargin="2.5cm"
+          bottomMargin="2.5cm"
+          title="Example 5 - templates and pageTemplates"
+          author="Reportlab Inc (Documentation Team)"
+          showBoundary="1"
+          allowSplitting="20"
+          >
+          <!-- showBoundary means that we will be able to see the            -->
+          <!-- limits of frames                                              -->
+    <pageTemplate id="main">
+          <pageGraphics>
+          </pageGraphics>
+          <frame id="titleBox" x1="2.5cm" y1="27.7cm" width="16cm"
+              height="1cm"/>
+          <frame id="columnOne" x1="2.5cm" y1="2.5cm" width="7.5cm"
+              height="24.7cm"/>
+          <frame id="columnTwo" x1="11cm" y1="2.5cm" width="7.5cm"
+              height="24.7cm"/>
+    </pageTemplate>
+</template>
+<stylesheet>
+    <initialize>
+          <name id="FileTitle" value="Example 5 - templates and
+              pageTemplates"/>
+          <name id="ColumnOneHeader" value="This is Column One"/>
+          <name id="ColumnTwoHeader" value="This is Column Two"/>
+    </initialize>
+    <paraStyle name="titleBox"
+    fontName="Helvetica-Bold"
+    fontSize="18"
+    spaceBefore="0.4 cm"
+     alignment="CENTER"
+     />
+     <paraStyle name="body"
+     fontName="Helvetica"
+     fontSize="10"
+     leftIndent="5"
+     spaceAfter="5"
+     />
+</stylesheet>
+<story>
+     <para style="titleBox">
+     <b><getName id="FileTitle"/></b>
+     </para>
+     <nextFrame/>
+     <condPageBreak height="144"/><h2>
+         <getName id="ColumnOneHeader"/>
+     </h2>
+     <para>
+         This is the contents for <b>column one</b>.
+     </para>
+     <para>
+         It uses the default style for paragraph.
+     </para>
+     <para>
+         Does it come out OK?
+     </para>
+     <para>
+         There now follows some random text to see how these paragraphs
+         look with longer content:
+     </para>
+     <para>
+         Blah blah morale blah benchmark blah blah blah blah blah blah
+         communication blah blah blah blah blah blah blah blah blah
+         blah stretch the envelope blah blah blah.
+     </para>
+     <para>
+         Blah blah blah blah blah blah blah blah blah blah blah blah
+         architect blah inter active backward-compatible blah blah blah
+         blah blah. Blah blah blah blah value-added.
+     </para>
+     <para>
+         Blah blah blah blah blah blah blah blah blah re-factoring
+         phase blah knowledge management blah blah. Blah blah blah blah
+         interactive blah vision statement blah.
+     </para>
+     <para>
+         Blah blah blah blah blah blah conceptualize blah downsize blah
+         blah blah blah. Blah blah blah blah blah blah blah blah blah
+         blah blah blah synergy client-centered vision statement.
+     </para>
+     <para>
+         Blah blah dysfunctional blah blah blah blah blah blah blah
+         appropriate blah blah blah blah blah blah blah blah
+         re-factoring go the extra mile blah blah blah blah.
+     </para>
+     <nextFrame/>
+     <condPageBreak height="144"/>
+<h2>
+         <getName id="ColumnTwoHeader"/>
+     </h2>
+     <para style="body">
+         This is the contents for <i>column two</i>.
+     </para>
+     <para style="body">
+         It uses the paragraph style we have called "body".
+     </para>
+     <para style="body">
+         Does it come out OK?
+     </para>
+     <para style="body">
+         There now follows some random text to see how these paragraphs
+         look with longer content:
+     </para>
+     <para style="body">
+         Blah OS/2 blah blah blah blah coffee blah blah blah blah
+         Windows blah blah blah blah blah blah blah. Blah blah blah
+         blah blah blah blah Modula-3 blah blah blah. Blah blah bug
+         report blah blah blah blah blah memory blah blah TeX TCP/IP
+         SMTP blah blah.
+     </para>
+     <para style="body">
+         Blah blah blah blah blah Em blah letterform blah blah blah
+         blah blah blah blah blah blah letterform blah blah. Blah blah
+         blah blah leader blah blah blah blah.
+     </para>
+     <para style="body">
+         Blah blah blah blah blah uppercase blah blah right justified
+         blah blah blah flush-right blah blah blah. Blah blah blah blah
+         blah blah spot-colour blah Em.
+     </para>
+     <para style="body">
+         Blah dingbat blah blah blah blah blah blah blah blah blah blah
+         blah blah blah blah blah. Blah blah blah blah blah drop-cap
+         blah blah blah blah blah blah blah.
+     </para>
+</story>
+</document>
+


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex05.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex06.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex06.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex06.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="sample.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+	<pageTemplate id="main">
+		<pageGraphics>
+			<stroke color="red"/>
+			<curves>
+			198 560
+			198 280
+			396 280
+			396 560
+			</curves>
+			<stroke color="black"/>
+		</pageGraphics>
+		<frame id="first" x1="72" y1="72" width="451" height="698"/>
+	</pageTemplate>
+</template>
+<stylesheet>
+</stylesheet>
+<story>
+     <h1>
+         seq in seq, seqDefault and seqReset
+     </h1>
+     <para>copied: <seq id="spam"/>, <seq id="spam"/>, <seq id="spam"/>.
+Reset<seqReset id="spam"/>.   <seq id="spam"/>, <seq id="spam"/>,
+<seq id="spam"/>.</para>
+     <h2>
+         <i>simple use of seq</i>
+     </h2>
+     <para>
+         First seq: <seq/>
+     </para>
+     <para>
+         Second seq: <seq/>
+     </para>
+     <spacer length="6"/>
+     <para>
+         <seqReset/>
+         We have just done a &lt;seqReset"/&gt;
+     </para>
+     <spacer length="6"/>
+     <para>
+         First seq after seqReset: <seq/>
+     </para>
+     <para>
+         second seq after seqReset: <seq/>
+     </para>
+     <spacer length="6"/>
+     <para>
+         If you are going to use multiple seq tags, you need to use the "id" attribute.
+     </para>
+     <h2>
+         <i>Better use of seq</i>
+     </h2>
+     <para>
+         <seqDefault id="test"/>
+         We have just done a &lt;seqDefault id="test"/&gt;
+     </para>
+     <para>
+         <seqReset id="test"/>
+         We have just done a &lt;seqReset id="test"/&gt;
+     </para>
+     <spacer length="6"/>
+     <para>
+         First seq: <seq id="test"/>
+     </para>
+     <para>
+         Second seq: <seq id="test"/>
+     </para>
+     <spacer length="6"/>
+     <para>
+         <seqReset id="test"/>
+         We have just done a &lt;seqReset id="test"/&gt;
+     </para>
+     <spacer length="6"/>
+     <para>
+         First seq after seqReset: <seq id="test"/>
+     </para>
+     <para>
+         second seq after seqReset: <seq id="test"/>
+     </para>
+     <h2>
+         <i>Using two seqs independently</i>
+     </h2>
+     <para>
+         <seqReset id="testOne"/>
+         We have just done a &lt;seqReset id="testOne"/&gt;
+     </para>
+     <para>
+         <seqReset id="testTwo"/>
+         We have just done a &lt;seqReset id="testTwo"/&gt;
+     </para>
+     <spacer length="6"/>
+     <para>
+         First seq for testOne: <seq id="testOne"/>
+     </para>
+     <para>
+         Second seq for testOne: <seq id="testOne"/>
+     </para>
+     <spacer length="6"/>
+     <para>
+         First seq for testTwo: <seq id="testTwo"/>
+     </para>
+     <para>
+         Second seq for testTwo: <seq id="testTwo"/>
+     </para>
+     <spacer length="6"/>
+     <para>
+         <seqReset id="testOne"/>
+         We have just done a &lt;seqReset id="testOne"/&gt;
+     </para>
+     <spacer length="6"/>
+     <para>
+         First seq after seqReset for testOne: <seq id="testOne"/>
+     </para>
+     <para>
+         second seq after seqReset for testOne: <seq id="testOne"/>
+     </para>
+     <spacer length="6"/>
+     <para>
+         First seq after seqReset for testTwo: <seq id="testTwo"/>
+     </para>
+     <para>
+         second seq after seqReset for testTwo: <seq id="testTwo"/>
+     </para>
+     <spacer length="15"/>
+     <para>
+         Notice how resetting testOne doesn't affect testTwo at all.
+     </para>
+</story>
+</document>
+


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex06.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex07.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex07.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex07.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="sample.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+     <pageTemplate id="main">
+     <pageGraphics>
+         <fill color="red"/>
+         <stroke color="black"/>
+         <path x="247" y="72" fill="yes" stroke="yes" close="yes">
+            247 172
+            147 172
+            147 272
+            247 272
+            247 372
+            347 372
+            347 372
+            347 272
+            447 272
+            447 172
+            347 172
+            347 72
+            <!-- This completes the first shape: a red cross.-->
+         <moveto>267 572</moveto>
+            <!-- This moves the "pen position"                              -->
+            <!-- Notice that because we have used a "moveto", the           -->
+            <!-- final line at the base of the cross is not completed, even -->
+            <!-- though the "close" attribute of the "path" tag is set to   -->
+            <!-- "yes"                                                      -->
+            277 612
+            <!-- this acts as the start point for the Bezier curves below   -->
+          <curvesto>
+               147 585
+               147 687
+               297 792
+               447 687 447 585 317 612
+          </curvesto>
+               327 572
+               <!-- We don't need to give the last point because close is -->
+               <!-- set to "yes"                                                     -->
+          </path>
+     </pageGraphics>
+     <frame id="first" x1="72" y1="72" width="451" height="698"/>
+     </pageTemplate>
+</template>
+<stylesheet>
+</stylesheet>
+<story>
+<para></para>
+</story>
+</document>
+


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex07.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex08.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex08.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex08.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd">
+<document filename="sample.pdf">
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        / >
+        
+<stylesheet>
+</stylesheet>
+<pageDrawing>
+          <fill color="red"/>
+          <stroke color="black"/>
+          <path x="247" y="72" fill="yes" stroke="yes" close="yes">
+               247 172
+               147 172
+               147 272
+               247 272
+               247 372
+               347 372
+               347 372
+               347 272
+               447 272
+               447 172
+               347 172
+               347 72
+          <moveto>267 572</moveto>
+               277 612
+          <curvesto>
+               147 585 147 687 297 792
+               447 687 447 585 317 612
+          </curvesto>
+               327 572
+          </path>
+</pageDrawing>
+</document>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex08.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex09.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex09.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex09.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="sample.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+     <pageTemplate id="main">
+     <pageGraphics>
+         <grid xs="1cm,2cm,3cm,4cm,5cm,10cm,20cm" ys="1cm,2cm,3cm,4cm,5cm,10cm,20cm"/>
+         <place x="10.5cm" y="10.5cm" width="9cm" height="9cm">
+             <title>This is a use of <i>place</i></title>
+             <spacer length="15"/>
+             <para>
+             This is a flowable. In this case, it is in a &lt;para&gt;
+             tag, but it could be any flowable. It has been placed
+             inside a grid, but you could put it inside any graphic or
+             pageGraphics. Using the place tag, you can have complete
+             control over where you want your flowables to appear.
+             </para>
+             <spacer length="12"/>
+             <para>
+             You can include Greek: <greek>abgd</greek>.
+             </para>
+             <spacer length="12"/>
+             <blockTable>
+             <tr>
+                 <td>Or</td><td>even</td>
+             </tr>
+             <tr>
+                 <td>a</td><td>blockTable.</td>
+             </tr>
+             </blockTable>
+         </place>
+     </pageGraphics>
+     <frame id="first" x1="72" y1="72" width="451" height="698"/>
+     </pageTemplate>
+</template>
+<stylesheet>
+     <paraStyle name="style.Title"
+     fontName="Courier-Bold"
+     fontSize="24"
+     leading="36"
+     />
+</stylesheet>
+<!-- The story starts below this comment -->
+<story>
+     <title>Example 9</title>
+     <para>
+     This is a page which shows you how illustrations, grids and the place tag work.
+     </para>
+     <illustration width="90" height="90">
+         <fill color="red"/>
+         <circle x="45" y="45" radius="30" fill="yes"/>
+         <setFont name="Times-Roman" size="8"/>
+         <drawString x="0" y="0">This is an illustration</drawString>
+     </illustration>
+     <para>
+     The red circle you can see is an <i>illustration</i>, not a <i>pageGraphic</i>.
+     </para>
+     <illustration width="75" height="75">
+         <fill color="teal"/>
+         <circle x="30" y="30" radius="30" fill="yes"/>
+         <stroke color="darkslategray"/>
+         <grid xs="15,30,45" ys="5,10,15,20,25,30,35,40,45,50"/>
+     </illustration>
+     <para>
+     So is the teal colored one.
+    </para>
+    <para>
+    These are all flowables in the story.
+    </para>
+</story>
+</document>
+


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex09.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex10.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex10.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex10.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="sample.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+    <pageTemplate id="main">
+    <pageGraphics>
+    </pageGraphics>
+    <frame id="first" x1="72" y1="72" width="451" height="698"/>
+    </pageTemplate>
+</template>
+<stylesheet>
+    <blockTableStyle id="myBlockTableStyle">
+         <!-- This sets a font for every cell from the start of the -->
+         <!-- second row down to the bottom right hand corner                   -->
+         <blockFont name="Courier-Bold" start="0,1" stop="-1,-1"/>
+         <!-- This sets a font for the first row           -->
+         <blockFont name="Helvetica-BoldOblique" size="24" start="0,0" stop="3,0"/>
+         <!-- This sets a textColor for all the text in the table -->
+         <blockTextColor colorName="black"/>
+         <!-- This sets a textColor for the first row             -->
+         <!-- (Since it comes after the above setting, -->
+         <!-- it overides it for this row) -->
+         <blockTextColor colorName="white" start="0,0" stop="3,0"/>
+         <!-- This sets a textColor a column - also overiding              -->
+         <!-- the first textColor setting for this row                     -->
+         <blockTextColor colorName="blue" start="1,1" stop="1,6"/>
+         <!-- This sets a background color for the first row              -->
+         <blockBackground colorName="red" start="0,0" stop="3,0"/>
+         <!-- This sets a background color for the rest of the table -->
+         <blockBackground colorName="cornsilk" start="0,1" stop="-1,-1"/>
+         <!-- This sets a background color for an individual cell                 -->
+         <!-- This has to go AFTER the above blockBackground,                     -->
+         <!-- otherwise it would be overpainted by the cornsilk color -->
+         <blockBackground colorName="lightcoral" start="3,3" stop="3,3"/>
+    </blockTableStyle>
+</stylesheet>
+<story>
+    <title>Example 10 - colors and fonts in tables</title>
+    <spacer length="1cm"/>
+    <blockTable style="myBlockTableStyle" rowHeights="3.5cm,2cm,2cm,2cm,2cm,2cm,2cm" colWidths="4cm,4cm,4cm,4cm">
+    <tr><td>Cell 0,0</td><td>Cell 1,0</td><td>Cell 2,0</td><td>Cell 3,0</td></tr>
+    <tr><td>Cell 0,1</td><td>Cell 1,1</td><td>Cell 2,1</td><td>Cell 3,1</td></tr>
+    <tr><td>Cell 0,2</td><td>Cell 1,2</td><td>Cell 2,2</td><td>Cell 3,2</td></tr>
+     <tr><td>Cell 0,3</td><td>Cell 1,3</td><td>Cell 2,3</td><td>Cell 3,3</td></tr>
+     <tr><td>Cell 0,4</td><td>Cell 1,4</td><td>Cell 2,4</td><td>Cell 3,4</td></tr>
+     <tr><td>Cell 0,5</td><td>Cell 1,5</td><td>Cell 2,5</td><td>Cell 3,5</td></tr>
+     <tr><td>Cell 0,6</td><td>Cell 1,6</td><td>Cell 2,6</td><td>Cell 3,6</td></tr>
+     </blockTable>
+</story>
+</document>
+


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex10.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex11.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex11.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex11.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="sample.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        >
+</template>
+<stylesheet>
+     <blockTableStyle id="myBlockTableStyle">
+          <!-- Set fonts -->
+          <blockFont name="Courier-Bold" size="10" start="0,1" stop="-1,-1"/>
+          <blockFont name="Helvetica-BoldOblique" size="10" start="0,0" stop="3,0"/>
+          <!-- This sets a textColor for all the text in the table -->
+          <blockTextColor colorName="black"/>
+          <!-- Another example of blockTextColor        -->
+          <blockTextColor colorName="green" start="2,2" stop="3,3"/>
+          <!-- This sets a blockAlignment for the whole table           -->
+          <blockAlignment value="CENTER"/>
+          <!-- These overrides the above       -->
+          <blockAlignment value="RIGHT" start="3,0" stop="3,-1"/>
+          <blockAlignment value="LEFT" start="0,1" stop="0,-1"/>
+          <!-- This sets the vertical alignment for one row          -->
+          <blockValign value="TOP" start="0,0" stop="-1,0"/>
+          <!-- This sets the vertical alignment for one cell          -->
+          <blockValign value="MIDDLE" start="2,2" stop="2,2"/>
+          <!-- Use of linestyles     -->
+          <lineStyle kind="GRID" colorName="silver"/>
+          <lineStyle kind="LINEBELOW" colorName="orangered" start="0,0"
+             stop="-1,0" thickness="5"/>
+          <lineStyle kind="LINEAFTER" colorName="maroon" start="1,1"
+             stop="1,6" thickness="1"/>
+     </blockTableStyle>
+</stylesheet>
+<story>
+     <title>Example 11 - lines and alignment in tables</title>
+     <spacer length="1cm"/>
+     <blockTable style="myBlockTableStyle"
+     rowHeights="2cm,2cm,2cm,2cm,2cm,2cm,2cm"
+     colWidths="4cm,3cm,3cm,4cm"
+     >
+     <tr>
+          <td>(a=LEFT)(VA=TOP)</td>
+          <td>(VA=TOP)</td>
+          <td>(VA="TOP")</td>
+          <td>(a=RIGHT)(VA=TOP)</td>
+     </tr>
+     <tr>
+         <td>(a=LEFT)</td>
+         <td>1,1</td>
+         <td>Cell 2,1</td>
+         <td>(a=RIGHT)</td>
+     </tr>
+     <tr>
+         <td>(a=LEFT)</td>
+         <td>1,2</td>
+         <td>(VA=MIDDLE)</td>
+         <td>(a=RIGHT)</td>
+     </tr>
+     <tr>
+         <td>(a=LEFT)</td>
+         <td>1,3</td>
+         <td>(VA=MIDDLE)</td>
+         <td>(VA=MDL)(a=RIGHT)</td>
+     </tr>
+     <tr>
+         <td>(a=LEFT)</td>
+         <td>1,4</td>
+         <td>2,4</td>
+         <td>(a=RIGHT)</td>
+     </tr>
+     <tr>
+         <td>(a=LEFT)</td>
+         <td>1,5</td>
+         <td>2,5</td>
+         <td>(a=RIGHT)</td>
+     </tr>
+     <tr>
+         <td>(a=LEFT)</td>
+         <td>1,6</td>
+         <td>2,6</td>
+         <td>(a=RIGHT)</td>
+     </tr>
+     </blockTable>
+<spacer length="15"/>
+<para>a=value for <i>blockAlignment</i></para>
+<para>VA=value for <i>blockValign</i></para>
+<para><i>MDLE=MIDDLE for VA in cells 3,2 and 3,3</i></para>
+</story>
+</document>
+


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex11.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex12.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex12.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex12.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="sample.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+     <pageTemplate id="main">
+     <pageGraphics>
+     </pageGraphics>
+     <frame id="first" x1="72" y1="72" width="451" height="698"/>
+     </pageTemplate>
+</template>
+<stylesheet>
+     <blockTableStyle id="myBlockTableStyle">
+          <blockBackground colorName="silver" start="0,0" stop="-1,0"/>
+          <blockBackground colorName="darkslategray" start="0,1" stop="-1,1"/>
+          <blockBackground colorName="silver" start="0,2" stop="-1,2"/>
+          <blockBackground colorName="darkslategray" start="0,3" stop="-1,3"/>
+          <blockBackground colorName="silver" start="0,4" stop="-1,4"/>
+          <blockBackground colorName="darkslategray" start="0,5" stop="-1,5"/>
+          <blockAlignment value="CENTER"/>
+          <blockValign value="MIDDLE"/>
+          <!-- Set fonts -->
+          <blockFont name="Helvetica-BoldOblique" size="10"/>
+          <!-- set the left and right padding for cells in first and third columns -->
+          <!-- remember, cell numbering starts from ZERO, not ONE                                   -->
+          <blockLeftPadding length="20" start="0,0" stop="0,-1"/>
+          <blockRightPadding length="20" start="2,0" stop="2,-1"/>
+          <!-- set the top and bottom padding for cells in first and third rows -->
+          <blockBottomPadding length="40" start="0,0" stop="-1,0"/>
+          <blockTopPadding length="40" start="0,2" stop="-1,2"/>
+          <!-- set the top and bottom padding for the last row -->
+          <blockBottomPadding length="40" start="-1,4" stop="-1,4"/>
+          <blockTopPadding length="40" start="0,4" stop="0,4"/>
+          <!-- Use of linestyles          -->
+          <lineStyle kind="GRID" colorName="darkblue"/>
+     </blockTableStyle>
+     <paraStyle name="paddingTableStyle"
+          fontName="Helvetica-BoldOblique"
+          fontSize="10"
+          textColor="white"
+          alignment="CENTER"
+          />
+</stylesheet>
+<story>
+     <title>Example 12 - pict and padding in tables</title>
+     <spacer length="1cm"/>
+     <blockTable style="myBlockTableStyle" rowHeights="166,28,166,28,166,28" colWidths="161,161,161">
+<tr>
+       <td><illustration width="141" height="90">
+                <fsimage file="../sample/replogo.gif" x="0" y="0" width="141" height="90"/>
+                <stroke color="deepskyblue"/>
+                <lineMode width="3"/>
+                <lines>
+                0 0 141 0
+                141 0 141 90
+                141 90 0 90
+                0 90 0 0
+                </lines>
+            </illustration>
+       </td>
+       <td><illustration width="141" height="90">
+                <fsimage file="../sample/replogo.gif" x="0" y="0" width="141" height="90"/>
+                <stroke color="deepskyblue"/>
+                <lineMode width="3"/>
+                <lines>
+                0 0 141 0
+                141 0 141 90
+                141 90 0 90
+                0 90 0 0
+                </lines>
+            </illustration>
+       </td>
+       <td><illustration width="141" height="90">
+                <fsimage file="../sample/replogo.gif" x="0" y="0" width="141" height="90"/>
+                <stroke color="deepskyblue"/>
+                <lineMode width="3"/>
+                <lines>
+                0 0 141 0
+                141 0 141 90
+                141 90 0 90
+                0 90 0 0
+                </lines>
+            </illustration>
+       </td>
+</tr>
+<tr>
+       <td>
+       <para style="paddingTableStyle">
+            <b>blockLeftPadding</b> with <b>blockBottomPadding</b>
+       </para>
+       </td>
+       <td>
+       <para style="paddingTableStyle">
+            just blockBottomPadding
+       </para>
+       </td>
+       <td>
+       <para style="paddingTableStyle">
+            <b>blockRightPadding</b> with <b>blockBottomPadding</b>
+       </para>
+       </td>
+    </tr>
+    <tr>
+       <td><illustration width="141" height="90">
+                <fsimage file="../sample/replogo.gif" x="0" y="0" width="141" height="90"/>
+                <stroke color="deepskyblue"/>
+                <lineMode width="3"/>
+                <lines>
+                0 0 141 0
+                141 0 141 90
+                141 90 0 90
+                0 90 0 0
+                </lines>
+            </illustration>
+   </td>
+   <td><illustration width="141" height="90">
+           <fsimage file="../sample/replogo.gif" x="0" y="0" width="141" height="90"/>
+           <stroke color="deepskyblue"/>
+           <lineMode width="3"/>
+           <lines>
+           0 0 141 0
+           141 0 141 90
+           141 90 0 90
+           0 90 0 0
+           </lines>
+       </illustration>
+   </td>
+   <td><illustration width="141" height="90">
+           <fsimage file="../sample/replogo.gif" x="0" y="0" width="141" height="90"/>
+           <stroke color="deepskyblue"/>
+           <lineMode width="3"/>
+           <lines>
+           0 0 141 0
+           141 0 141 90
+           141 90 0 90
+           0 90 0 0
+           </lines>
+       </illustration>
+   </td>
+</tr>
+<tr>
+   <td>
+   <para style="paddingTableStyle">
+       <b>blockLeftPadding</b> with <b>blockTopPadding</b>
+   </para>
+   </td>
+   <td>
+   <para style="paddingTableStyle">
+       just blockTopPadding
+   </para>
+   </td>
+   <td>
+   <para style="paddingTableStyle">
+       <b>blockRightPadding</b> with <b>blockTopPadding</b>
+   </para>
+   </td>
+</tr>
+<tr>
+   <td><illustration width="141" height="90">
+           <fsimage file="../sample/replogo.gif" x="0" y="0" width="141" height="90"/>
+           <stroke color="deepskyblue"/>
+           <lineMode width="3"/>
+           <lines>
+           0 0 141 0
+           141 0 141 90
+           141 90 0 90
+           0 90 0 0
+           </lines>
+       </illustration>
+   </td>
+   <td><illustration width="141" height="90">
+           <fsimage file="../sample/replogo.gif" x="0" y="0" width="141" height="90"/>
+           <stroke color="deepskyblue"/>
+           <lineMode width="3"/>
+           <lines>
+           0 0 141 0
+           141 0 141 90
+           141 90 0 90
+           0 90 0 0
+           </lines>
+       </illustration>
+   </td>
+            <td><illustration width="141" height="90">
+                     <fsimage file="../sample/replogo.gif" x="0" y="0" width="141" height="90"/>
+                     <stroke color="deepskyblue"/>
+                     <lineMode width="3"/>
+                     <lines>
+                     0 0 141 0
+                     141 0 141 90
+                     141 90 0 90
+                     0 90 0 0
+                     </lines>
+                 </illustration>
+            </td>
+         </tr>
+         <tr>
+            <td>
+            <para style="paddingTableStyle">
+                 blockLeftPadding with blockTopPadding
+            </para>
+            </td>
+            <td>
+            <para style="paddingTableStyle">
+                 no padding
+            </para>
+            </td>
+            <td>
+            <para style="paddingTableStyle">
+                 blockRightPadding with blockBottomPadding
+            </para>
+            </td>
+         </tr>
+     </blockTable>
+</story>
+</document>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex12.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex13.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex13.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex13.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="sample.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+	 <pageTemplate id="main">
+		<pageGraphics>
+		<fill color="(0.04,0.28,0.56)"/>
+		<stroke color="(0.23,0.15,0.40)"/>
+		<path x="23mm" y="10mm" close="no" fill="yes" stroke="yes">
+			5mm 10mm 5mm 292mm 23mm 292mm
+			<moveto>
+				23mm 281mm
+			</moveto>
+			23mm 194mm 116mm 194mm 116mm 184mm 23mm 184mm 23mm 141mm
+			72mm 141mm 72mm 131mm 23mm 131mm 23mm 31mm
+		</path>
+		<path x="5mm" y="281mm" close="no" fill="yes" stroke="yes">
+			5mm 292mm 204mm 292mm 204mm 281mm
+			<moveto>
+				195mm 281mm
+			</moveto>
+			150mm 281mm 143mm 273mm 72mm 273mm 64mm 281mm 23mm 281mm
+		</path>
+		<path x="195mm" y="292mm" close="no" fill="yes" stroke="yes">
+			204mm 292mm 204mm 10mm 195mm 10mm
+			<moveto>
+				195mm 31mm
+			</moveto>
+			195mm 73mm 110mm 73mm 110mm 83mm 195mm 83mm 195mm 131mm
+			110mm 131mm 110mm 141mm 195mm 141mm 195mm 281mm
+		</path>
+		<path x="5mm" y="31mm" close="no" fill="yes" stroke="yes">
+			5mm 10mm 204mm 10mm 204mm 31mm
+			<moveto>
+				195mm 31mm
+			</moveto>
+			23mm 31mm
+		</path>
+		<fill color="(0.86,0.91,0.95)"/>
+		<path x="110mm" y="73mm" close="yes" fill="yes" stroke="yes">
+			110mm 37mm 195mm 37mm 195mm 73mm
+		</path>
+		<path x="110mm" y="131mm" close="yes" fill="yes" stroke="yes">
+			110mm 95mm 195mm 95mm 195mm 131mm
+		</path>
+		<fill color="white"/>
+		<setFont name="Helvetica" size="18"/>
+		<drawCentredString x="107mm" y="275mm">Auction-in-Europe.com</drawCentredString>
+		<setFont name="Helvetica" size="9"/>
+		<drawString x="23mm" y="26mm">Tiny sprl</drawString>
+		<drawString x="23mm" y="22mm">Tel: +32.10.68.94.39</drawString>
+		<drawString x="23mm" y="18mm">Fax: +32.10.68.94.39</drawString>
+		<drawString x="23mm" y="14mm">Email: fp at tiny.be</drawString>
+		<drawRightString x="195mm" y="26mm">Rue Joseph Mathieu, 28</drawRightString>
+		<drawRightString x="195mm" y="22mm">B-1300 Limal</drawRightString>
+		<drawRightString x="195mm" y="18mm">TVA: BE.477.472.701</drawRightString>
+		<drawRightString x="195mm" y="14mm">R.C.N. 95636</drawRightString>
+		<fsimage file="../sample/logo.png" x="90mm" y="15mm"/>
+		<fsimage file="../sample/screenshot.jpg" x="28mm" y="196mm"/>
+
+		<setFont name="Helvetica" size="14"/>
+		<drawCentredString x="71mm" y="187mm">Un concept efficace</drawCentredString>
+		<drawCentredString x="48mm" y="134mm">Leader en Belgique</drawCentredString>
+		<drawCentredString x="153mm" y="134mm">Gestion des sites marchands</drawCentredString>
+		<drawCentredString x="153mm" y="76mm">Des services uniques</drawCentredString>
+		</pageGraphics>
+		<fill color="black"/>
+		<frame id="first" x1="110mm" y1="190mm" width="80mm" height="80mm"/>
+		<frame id="second" x1="27mm" y1="139mm" width="163mm" height="42mm"/>
+		<frame id="trois" x1="27mm" y1="37mm" width="75mm" height="90mm"/>
+		<frame id="quatre" x1="112mm" y1="96mm" width="82mm" height="34mm"/>
+		<frame id="cinq" x1="112mm" y1="36mm" width="82mm" height="37mm"/>
+	</pageTemplate>
+</template>
+<stylesheet>
+	<paraStyle name="bigurl" fontName="Courier-Bold" fontSize="12" spaceBefore="0.5cm" textColor="red"/>
+	<paraStyle name="description" fontName="Helvetica-Oblique" fontSize="12" spaceBefore="0.2cm" spaceAfter="0.7" textColor="black" alignment="right"/>
+	<paraStyle name="small" fontName="Helvetica" fontSize="8" alignment="justify"/>
+	<paraStyle name="subtitle" fontName="Courier-Bold" fontSize="10" spaceBefore="5mm" spaceAfter="2mm" />
+	<paraStyle name="data" fontName="Helvetica" fontSize="10"/>
+	<paraStyle name="footnote" fontName="Helvetica" fontSize="8" alignment="center" spaceBefore="3mm"/>
+	<paraStyle name="centered" fontName="Helvetica-Oblique" fontSize="10" alignment="center"/>
+	<paraStyle name="bullet" fontName="Helvetica" fontSize="10" leftIndent="10mm" firstLineIndent="-10mm"/>
+</stylesheet>
+<story>
+	<spacer length="0.8cm"/>
+	<para style="bigurl">http://art-in-europe.com</para>
+	<para style="description">Artistes et galeries d'art</para>
+	<para style="bigurl">http://antique-in-europe.com</para>
+	<para style="description">Antiquaires</para>
+	<para style="bigurl">http://auction-in-europe.com</para>
+	<para style="description">Salles de ventes publiques</para>
+	<nextFrame/>
+	<para style="small">
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+		Depuis toujours nos sites sont en avance sur leur temps.
+	</para>
+	<nextFrame/>
+	<para style="subtitle">Base de donnee</para>
+	<para style="data">90.000 oeuvres, 23.000 photos</para>
+	<para style="data">300 artistes contemporains</para>
+	<para style="data">8.000 objets a vendre par mois</para>
+	<para style="data">250 ventes directes/mois</para>
+	<para style="subtitle">Base de donnee</para>
+	<para style="data">90.000 oeuvres, 23.000 photos</para>
+	<para style="data">300 artistes contemporains</para>
+	<para style="data">8.000 objets a vendre par mois</para>
+	<para style="data">250 ventes directes/mois</para>
+	<para style="subtitle">Base de donnee</para>
+	<para style="data">90.000 oeuvres, 23.000 photos</para>
+	<para style="data">8.000 objets a vendre par mois</para>
+	<para style="data">250 ventes directes/mois</para>
+	<para style="footnote">(*) chiffres calcules le 12/12/2003</para>
+	<nextFrame/>
+	<para style="centered">
+	Flagey.com, ArthusGallery.com, Ferraton.be, python.org
+	Flagey.com, Zope.org, Ferraton.be, Debian.org
+	Flagey.com, Ferraton.be, Google.com
+	Flagey.com, Google.be, Ferraton.be,
+	Flagey.com, ArthusGallery.com, Ferraton.be,
+	Flagey.com, ArthusGallery.com, Ferraton.be, python.org
+	Flagey.com, Zope.org, Debian.org
+	</para>
+	<nextFrame/>
+	<para style="bullet">- Test des bullets fds fkldsjf dslksfdjmlsfd fdsjhdkj kljsfd lmsfd jsfmdlk j jsdhks djhskls djfk.</para>
+	<para style="bullet">- Test des bullets kljsfd lmsfd jsfmdlk j jsdhks djhskls djfk.</para>
+	<para style="bullet">- Test des bullets</para>
+	<para style="footnote">(*) chiffres calcules le 12/12/2003</para>
+</story>
+</document>
+


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex13.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex14.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex14.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex14.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="sample.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+        <pageTemplate id="first">
+        <pageGraphics>
+            <lines>2cm 3.2cm 19cm 3.2cm</lines>
+            <drawCentredString x="105mm" y="3.4cm">www.printbox.be - 0477/76.18.56 - printbox.be</drawCentredString>
+            <drawCentredString x="105mm" y="2.6cm">Tiny SPRL - rue Joseph Mathieu, 28 - B-1300 Limal - BELGIQUE - info at tiny.be</drawCentredString>
+            <drawCentredString x="105mm" y="2.0cm">RCN 95656 - TVA BE477.472.701 - IBAN: BE74 1262 0132 6907 - SWIFT: ARTEBEBB</drawCentredString>
+            <fsimage file="../sample/devis_logo.jpg" x="23mm" y="23cm" />
+
+            <setFont name="Helvetica" size="135"/>
+            <fill color="(1,0.9,0.9)"/>
+            <stroke color="(1,0.9,0.9)"/>
+            <translate dx="15cm" dy="-5.5cm"/>
+            <rotate degrees="50"/>
+            <drawString x="23mm" y="12.7cm">DRAFT</drawString>
+            <lineMode width="5mm"/>
+            <rect round="1cm" x="18mm" y="12.2cm" width="17cm" height="5cm" fill="no" stroke="yes"/>
+
+        </pageGraphics>
+        <frame id="address" x1="11.2cm" y1="21.0cm" width="8cm" height="4.2cm"/>
+        <frame id="column" x1="2.0cm" y1="7.0cm" width="17cm" height="14cm"/>
+    </pageTemplate>
+</template>
+<stylesheet>
+    <blockTableStyle id="products">
+         <blockFont name="Helvetica-BoldOblique" size="24" start="0,0" stop="-1,0"/>
+         <blockBackground colorName="grey" start="0,0" stop="-1,0"/>
+         <blockTextColor colorName="white" start="0,0" stop="-1,0"/>
+         <blockValign value="TOP"/>
+         <blockAlignment value="RIGHT" start="1,0" stop="-1,-1"/>
+         <blockAlignment value="RIGHT" start="0,-3" stop="-1,-1"/>
+         <lineStyle kind="LINEBELOW" colorName="black" start="0,0" stop="-1,0"/>
+         <lineStyle kind="LINEABOVE" colorName="black" start="-1,-3" stop="-1,-3"/>
+         <lineStyle kind="LINEABOVE" colorName="black" start="-1,-1" stop="-1,-1"/>
+         <lineStyle kind="LINEBELOW" colorName="black" start="-1,-1" stop="-1,-1"/>
+         <lineStyle kind="LINEBEFORE" colorName="black" start="-1,-1" stop="-1,-1"/>
+         <lineStyle kind="LINEAFTER" colorName="black" start="-1,-1" stop="-1,-1"/>
+         <blockBackground colorName="(0.85,0.85,0.85)" start="-1,-1" stop="-1,-1"/>
+    </blockTableStyle>
+    <paraStyle name="conditions" fontName="Helvetica" fontSize="8" alignment="justify"/>
+</stylesheet>
+<story>
+    <xpre><b>Fabien Pinckaers</b>
+Rue Joseph Mathieu 28
+1300 Limal
+Tel: <i>010.68.94.39</i>
+    </xpre>
+    <nextFrame/>
+    <para>
+        <b>Document</b>: <i>Devis impression sur textile</i>
+    </para>
+    <spacer length="1cm" width="1mm"/>
+    <para>
+        Madame, Monsieur,
+    </para>
+    <spacer length="5mm" width="1mm"/>
+    <para>
+        Vous trouverez ci-join le devis suite a votre demande faite sur notre site.
+    </para>
+    <spacer length="1cm" width="1mm"/>
+    <blockTable colWidths="10cm,2.2cm,1.0cm,2.5cm" style="products">
+    <tr>
+        <td>Description</td><td>Prix Unit.</td><td>Qty</td><td>Prix HTVA</td>
+    </tr><tr>
+        <td>Chemises</td><td>23.00</td><td>32</td> <td>345.00</td>
+    </tr><tr>
+        <td>T-shirts</td><td>23.00</td><td>32</td> <td>345.00</td>
+    </tr><tr>
+        <td>HTVA:</td><td/><td/><td>100.00</td>
+    </tr><tr>
+        <td>TVA:</td><td/><td/><td>20.00</td>
+    </tr><tr>
+        <td>TVAC:</td><td/><td/><td>120.00</td>
+    </tr>
+    </blockTable>
+    <spacer length="1cm" width="1mm"/>
+    <para style="conditions">
+        Tout acceptation de ce devis necessite le <b>renvoi de ce dernier</b> apres avoir ete date et signe et
+        suivi des mentions suivantes : <i>"lu et approuve"</i> et <i>"bon pour accord"</i>.
+    </para>
+    <spacer length="0.5cm" width="1mm"/>
+    <para style="conditions">
+        <b>Tout contrat conclu avec notre societe est exclusivement regi par nos
+        conditions generales.</b>
+    </para>
+</story>
+</document>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/ex14.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/generic_template.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/generic_template.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/generic_template.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,324 @@
+<?xml version="1.0" encoding="utf-8"?>
+<template 
+    filename="default.pdf"
+    pagesize="A4" 
+    landscape="0" 
+    showboundary="0"
+    leftmargin="1cm"
+    rightmargin="1cm"
+    topmargin="1cm"
+    bottommargin="1cm"
+    allowsplitting="1">
+
+  <stylesheet>
+
+   <paragraphstyle 
+       name="Base" 
+       fontName="Helvetica" 
+       fontSize="10" 
+       align="LEFT" 
+       firstLineIndent="0cm" 
+       leftIndent="0.5cm" 
+       rightIndent="0cm" 
+       spaceBefore="0" 
+       spaceAfter="0" 
+       leading="0.5cm" 
+       bulletFontName="Helvetica" 
+       bulletIndent="0cm" 
+       bulletFontSize="10" />
+
+   <paragraphstyle 
+       name="Normal" 
+       fontName="Helvetica" 
+       fontSize="10" 
+       leading="0.5cm" />
+
+   <paragraphstyle 
+       name="BodyText" 
+       parent="Base" 
+       spaceBefore="4" />
+
+   <paragraphstyle 
+       name="BodyText1" 
+       parent="Base" 
+       spaceBefore="4" />
+
+   <paragraphstyle 
+       name="BodyText2" 
+       parent="Base" 
+       spaceBefore="4" 
+       leftIndent="0.5cm"/>
+
+   <paragraphstyle 
+       name="BodyText3" 
+       parent="Base" 
+       spaceBefore="4" 
+       leftIndent="1.0cm"/>
+
+   <paragraphstyle 
+       name="BodyText4" 
+       parent="Base" 
+       spaceBefore="4" 
+       leftIndent="1.5cm" />
+
+   <paragraphstyle 
+       name="Heading" 
+       parent="Base" 
+       leftIndent="0cm" 
+       fontName="Helvetica-Bold" 
+       fontSize="16" 
+       leading="0.5cm"
+       spaceBefore="4"
+       spaceAfter="4" />
+
+   <paragraphstyle 
+       name="Heading1" 
+       parent="Base"
+       leftIndent="0cm" 
+       fontName="Helvetica-Bold" 
+       fontSize="16"
+       leading="0.5cm" 
+       spaceBefore="4" 
+       spaceAfter="4" />
+
+   <paragraphstyle 
+       name="Heading2" 
+       parent="Base" 
+       leftIndent="0cm" 
+       fontName="Helvetica-Bold" 
+       fontSize="13" 
+       leading="0.5cm" 
+       spaceBefore="4" 
+       spaceAfter="4" />
+
+   <paragraphstyle 
+       name="Heading3" 
+       parent="Base" 
+       leftIndent="0cm" 
+       fontName="Helvetica-BoldOblique" 
+       fontSize="12" 
+       leading="0.3cm" 
+       spaceBefore="4" 
+       spaceAfter="4" />
+
+   <paragraphstyle 
+       name="Heading4" 
+       parent="Base" 
+       leftIndent="0cm" 
+       fontName="Helvetica-BoldOblique" 
+       fontSize="10" 
+       leading="0.3cm" 
+       spaceBefore="4" 
+       spaceAfter="4" />
+
+   <paragraphstyle 
+       name="Bullet" 
+       parent="Base"
+       bulletFontName="ZapfDingbats"
+       bulletFontSize="8" 
+       bulletIndent="0cm"
+       leftIndent="0cm"
+       firstLineIndent="0cm" 
+       spaceBefore="0"
+       spaceAfter="0" />
+
+   <paragraphstyle 
+       name="Bullet1" 
+       parent="Base"
+       bulletFontName="ZapfDingbats"
+       bulletFontSize="8" 
+       bulletIndent="0cm"
+       leftIndent="0cm" 
+       firstLineIndent="0cm" 
+       spaceBefore="0" 
+       spaceAfter="0" />
+
+   <paragraphstyle 
+       name="Bullet2" 
+       parent="Base" 
+       bulletFontName="ZapfDingbats" 
+       bulletFontSize="8" 
+       bulletIndent="0cm" 
+       leftIndent="0cm" 
+       firstLineIndent="0cm" 
+       spaceBefore="0"
+       spaceAfter="0" />
+
+   <paragraphstyle 
+       name="Bullet3" 
+       parent="Base" 
+       bulletFontName="ZapfDingbats" 
+       bulletFontSize="8" 
+       bulletIndent="0cm" 
+       leftIndent="0cm" 
+       firstLineIndent="0cm" 
+       spaceBefore="0" 
+       spaceAfter="0" />
+
+   <paragraphstyle 
+       name="Bullet4" 
+       parent="Base" 
+       bulletFontName="ZapfDingbats" 
+       bulletFontSize="8" 
+       bulletIndent="0cm" 
+       leftIndent="0cm" 
+       firstLineIndent="0cm" 
+       spaceBefore="0" 
+       spaceAfter="0" />
+
+   <paragraphstyle 
+       name="Sequence" 
+       parent="Base" 
+       bulletFontName="Helvetica" 
+       bulletFontSize="10" 
+       bulletIndent="0cm" 
+       leftIndent="0cm" 
+       firstLineIndent="0cm" 
+       spaceBefore="0" 
+       spaceAfter="0" />
+
+   <paragraphstyle 
+       name="Sequence1" 
+       fontName="Helvetica" 
+       fontSize="10" 
+       bulletFontName="Helvetica" 
+       bulletFontSize="10" 
+       bulletIndent="0.5cm" 
+       leftIndent="1.1cm" 
+       firstLineIndent="0cm" 
+       spaceBefore="6" 
+       spaceAfter="0" 
+       parent="Base" />
+
+   <paragraphstyle 
+       name="Sequence2" 
+       fontName="Helvetica" 
+       fontSize="10" 
+       bulletFontName="Helvetica" 
+       bulletFontSize="10" 
+       bulletIndent="1cm" 
+       leftIndent="1.6cm" 
+       firstLineIndent="0cm" 
+       spaceBefore="6" 
+       spaceAfter="0" 
+       parent="Base" />
+
+   <paragraphstyle 
+       name="Sequence3" 
+       fontName="Helvetica" 
+       fontSize="10" 
+       bulletFontName="Helvetica" 
+       bulletFontSize="10" 
+       bulletIndent="1.5cm" 
+       leftIndent="2.1cm" 
+       firstLineIndent="0cm" 
+       spaceBefore="6" 
+       spaceAfter="0" 
+       parent="Base" />
+
+   <paragraphstyle 
+       name="Sequence4" 
+       fontName="Helvetica" 
+       fontSize="10" 
+       bulletFontName="Helvetica" 
+       bulletFontSize="10" 
+       bulletIndent="2cm" 
+       leftIndent="2.6cm" 
+       firstLineIndent="0cm" 
+       spaceBefore="6" 
+       spaceAfter="0" 
+       parent="Base" />
+
+   <paragraphstyle 
+       name="Small" 
+       parent="Base" 
+       fontName="Helvetica-Bold" 
+       fontSize="7" />
+
+   <paragraphstyle 
+       name="Cell" 
+       parent="Base" 
+       fontName="Helvetica-Bold" 
+       fontSize="12" 
+       alignment="center" />
+
+   <paragraphstyle 
+       name="CellHeading" 
+       parent="Base" 
+       fontName="Helvetica-Bold" 
+       fontSize="13" 
+       alignment="center" />
+
+   <paragraphstyle 
+       name="Example" 
+       fontName="Courier-Oblique" 
+       fontSize="10" 
+       parent="Base" />
+
+   <paragraphstyle 
+       name="TitleHeader" 
+       parent="Base" 
+       fontName="Helvetica-Bold" 
+       fontSize="20" 
+       alignment="center" />
+
+   <paragraphstyle 
+       name="TitleAuthor" 
+       parent="Base" 
+       fontName="Helvetica" 
+       fontSize="12" 
+       alignment="center" />
+
+   <paragraphstyle 
+       name="TitleCenter" 
+       parent="Base" 
+       fontName="Helvetica" 
+       fontSize="14" 
+       alignment="center" />
+
+   <paragraphstyle 
+       name="TitleBottom" 
+       parent="Base" 
+       fontName="Helvetica" 
+       fontSize="10" 
+       alignment="center" />
+
+   <paragraphstyle 
+       name="DocumentHeader" 
+       parent="Base" 
+       fontName="Helvetica-Bold" 
+       fontSize="18" />
+
+   <tablestyle name="StandardTable">
+     <stylecmd expr="('LEFTPADDING', (0,0), (-1,-1), 5)"/>
+     <stylecmd expr="('RIGHTPADDING', (0,0), (-1,-1), 5)"/>
+     <stylecmd expr="('TOPPADDING', (0,0), (-1,-1), 3)"/>
+     <stylecmd expr="('BOTTOMPADDING', (0,0), (-1,-1), 7)"/>
+     <stylecmd expr="('ALIGN', (0,0), (-1,-1), 'LEFT')"/>
+     <stylecmd expr="('GRID', (0,0), (-1,-1), 0.5, colors.black)"/>
+     <stylecmd expr="('BOX', (0,0), (-1,-1), 1, colors.black)"/>
+     <stylecmd expr="('FONT', (1,1), (-1,-1), 'Helvetica', 10)"/>
+     <stylecmd expr="('FONT', (0,0), (-1,0), 'Helvetica-Bold', 10)"/>
+     <stylecmd expr="('FONT', (0,1), (0,-1), 'Courier', 10)"/>
+   </tablestyle>
+
+  </stylesheet>
+
+
+  <pagetemplate id="Page" >
+    <frame 
+        id="content"
+   	nextid="content"
+    	x="2cm" 
+        y="1.5cm" 
+	width="17cm" 
+	height="25.5cm" 
+	leftpadding="0.1cm"
+	rightpadding="0.1cm"
+	toppadding="0.5cm"
+	bottompadding="0.5cm"
+	showBoundary="0" 
+        />
+  </pagetemplate>
+
+</template>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/generic_template.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/logo.png
===================================================================
(Binary files differ)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/logo.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/micromeshfoto.bmp
===================================================================
(Binary files differ)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/micromeshfoto.bmp
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/micromeshfoto.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/micromeshfoto.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/micromeshfoto.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="rollcard.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+        <!-- showBoundary means that we will be able to see the   --> 
+        <!-- limits of frames                                     --> 
+
+    <pageTemplate id="main">
+      <pageGraphics>
+        <fsimage y="265mm" width="35.5mm" x="167mm" 
+            file="../sample/bopplogo.gif" height="25.6mm"/>
+      </pageGraphics>
+      <frame x1="15mm" y1="0mm" width="185mm" height="300mm" id="header" />
+      <frame x1="15mm" y1="87mm" width="185mm" height="11mm" id="middleline" />
+      <frame x1="15mm" y1="28mm" width="90mm" height="68mm" id="summary" />
+      <frame x1="110mm" y1="28mm" width="100mm" height="68mm" id="summary2" />
+      <!--<frame x1="0mm" y1="0mm" width="190mm"  height="17mm" id="footer" />-->
+      <frame x1="15mm" y1="0mm" width="185mm" height="17mm" id="footer" />
+    </pageTemplate>
+  </template>
+  <stylesheet>
+    <blockTableStyle id="headercompany">
+      <blockFont name="Helvetica" size="14"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockBottomPadding start="0,0" length="3mm" stop="-1,0"/>
+      <blockTextColor start="-1,1" stop="-1,-1" colorName="#FF8040"/>
+    </blockTableStyle>
+    <blockTableStyle id="headercharge">
+      <blockLeftPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockFont start="1,0" stop="1,-1" name="Helvetica-Bold" size="10"/>
+      <blockFont start="4,0" stop="4,-1" name="Helvetica-Bold" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockAlignment start="1,0" stop="1,-1" value="RIGHT"/>
+      <blockAlignment start="4,0" stop="4,-1" value="RIGHT"/>
+      <lineStyle start="0,0" kind="LINEABOVE" stop="-1,0" colorName="black"/>
+      <lineStyle start="0,2" kind="LINEBELOW" stop="-1,2" colorName="black"/>
+      </blockTableStyle><blockTableStyle id="middleline">
+      <lineStyle start="0,0" kind="LINEABOVE" stop="-1,0" colorName="black"/>
+    </blockTableStyle>
+    <blockTableStyle id="measuresummary">
+      <blockLeftPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockFont start="1,0" stop="-1,-1" name="Helvetica-Bold" size="10"/>
+      <blockFont start="0,0" stop="0,1" name="Helvetica-Bold" size="10"/>
+      <blockFont start="0,4" stop="0,4" name="Helvetica-Bold" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockAlignment start="1,0" stop="-1,-1" value="RIGHT"/>
+      <blockTopPadding start="0,1" length="5mm" stop="-1,1"/>
+      <blockTopPadding start="0,4" length="5mm" stop="-1,4"/>
+    </blockTableStyle>
+    <blockTableStyle id="measuresummary2">
+      <blockLeftPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockFont start="1,0" stop="-1,-1" name="Helvetica-Bold" size="10"/>
+      <blockFont start="0,0" stop="0,1" name="Helvetica-Bold" size="10"/>
+      <blockFont start="0,4" stop="0,4" name="Helvetica-Bold" size="10"/>
+      <blockFont start="0,7" stop="0,7" name="Helvetica-Bold" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockAlignment start="1,0" stop="-1,-1" value="RIGHT"/>
+      <blockTopPadding start="0,1" length="5mm" stop="-1,1"/>
+      <blockTopPadding start="0,4" length="5mm" stop="-1,4"/>
+      <blockTopPadding start="0,7" length="5mm" stop="-1,7"/>
+    </blockTableStyle>
+    <blockTableStyle id="footer">
+      <blockLeftPadding length="0mm"/>
+      <blockTopPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <lineStyle start="0,0" kind="LINEABOVE" stop="-1,0" colorName="black"/>
+      <blockAlignment start="4,0" stop="4,-1" value="RIGHT"/>
+    </blockTableStyle>
+  </stylesheet>
+  <story>
+    <spacer length="8mm"/>
+    <blockTable style="headercompany" colWidths="186mm">
+      <tr>
+        <td>G. Bopp + Co. AG, Bachmannweg 20, CH-8046 Zuerich</td>
+      </tr>
+      <tr><td>GEWEBE FOTO</td></tr>
+      <tr><td>WIRE MESH PICTURE</td></tr>
+    </blockTable>
+    <spacer length="4mm"/>
+    <blockTable style="headercharge" colWidths="55mm, 34mm, 15mm, 40.5mm, 38mm">
+      <tr>
+        <td>Charge / Batch</td>
+        <td>KM 29</td>
+        <td/>
+        <td>Fert.Auftragsnr. / Prod.-No.</td>
+        <td>Sefar</td>
+      </tr>
+      <tr>
+        <td>Material</td>
+        <td>Sefar vom Leguay 42-36</td>
+        <td/>
+        <td>Werkstoff / Alloy</td>
+        <td>.</td>
+      </tr>
+      <tr>
+        <td>Rollenbreite / Roll Width</td>
+        <td>1220 mm</td>
+        <td/>
+        <td>Geprueft nach / approved according to</td><td>ISO 9044</td></tr>
+    </blockTable>
+    <illustration width="183mm" height="144.3mm">
+      <fsimage x="0mm" y="0mm" width="182mm" height="136.5mm" file="../sample/micromeshfoto.bmp" />
+    </illustration>
+    <nextFrame/>
+    <blockTable style="middleline" colWidths="55mm, 34mm, 15mm, 40.5mm, 38mm">
+      <tr><td/><td/><td/><td/><td/></tr>
+    </blockTable>
+    <nextFrame/>
+    <blockTable style="measuresummary" colWidths="40mm, 16mm, 16mm, 16mm">
+      <tr><td>Messergebnisse:</td><td/><td/><td/></tr>
+
+      <tr><td>Kette</td><td>min</td><td>avg</td><td>max</td></tr>
+      <tr><td>Draht</td><td>35.93</td><td>37.36</td><td>46.84</td></tr>
+      <tr><td>Oeffnung</td><td>33.20</td><td>42.58</td><td>44.42</td></tr>
+
+      <tr><td>Schuss</td><td>min</td><td>avg</td><td>max</td></tr>
+      <tr><td>Draht</td><td>35.42</td><td>36.28</td><td>42.55</td></tr>
+      <tr><td>Oeffnung</td><td>41.28</td><td>46.50</td><td>47.94</td></tr>
+    </blockTable>
+    <nextFrame/>
+
+    <blockTable style="measuresummary2" colWidths="47mm, 12mm, 20mm">
+      <tr><td></td><td/><td/></tr>
+      <tr><td>Mesh</td><td/><td/></tr>
+      <tr>
+        <td>Kette / Warp</td><td/><td>317.85</td>
+      </tr>
+      <tr>
+        <td>Schuss / Weft</td><td/><td>306.88</td>
+      </tr>
+      <tr>
+	<td>Maschen</td><td/><td/>
+      </tr>
+      <tr>
+        <td>gueltig</td>
+	<td>198</td>
+	<td>97.06%</td>
+      </tr>
+      <tr>
+        <td>ungueltig</td>
+	<td>6</td>
+	<td>2.94%</td>
+      </tr>
+      <tr><td>Offene Siebflaeche / Open Area [%]</td><td/><td>29.92</td></tr>
+    </blockTable>
+    <nextFrame/>
+    <blockTable style="footer" colWidths="55mm, 34mm, 15mm, 40.5mm, 38mm">
+    <!--<blockTable style="footer" colWidths="26.5mm, 55mm, 34mm, 15mm, 40.5mm, 38mm">-->
+      <tr>
+        <td>Datum / Date: 05.01.2005</td>
+        <td/>
+        <td/>
+        <td>Pruefer / Inspector: Colner Davor</td>
+        <td>
+          <illustration width="25mm" height="9.5mm">
+            <fsimage y="-4mm" width="25mm" x="0mm" file="../sample/dcolner.gif" height="9.5mm"/>
+          </illustration>
+        </td>
+      </tr>
+    </blockTable>
+  </story>
+</document>
\ No newline at end of file


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/micromeshfoto.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/micromeshprot.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/micromeshprot.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/micromeshprot.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,250 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="rollcard.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+        <!-- showBoundary means that we will be able to see the   --> 
+        <!-- limits of frames                                     --> 
+
+    <pageTemplate id="main">
+      <pageGraphics>
+        <fsimage y="265mm" width="35.5mm" x="167mm" 
+            file="../sample/bopplogo.gif" height="25.6mm"/>
+      </pageGraphics>
+      <frame x1="15mm" y1="0mm" width="185mm" height="300mm" id="header" />
+      <frame x1="15mm" y1="87mm" width="185mm" height="11mm" id="middleline" />
+      <frame x1="15mm" y1="28mm" width="90mm" height="68mm" id="summary" />
+      <frame x1="110mm" y1="28mm" width="100mm" height="68mm" id="summary2" />
+      <frame x1="15mm" y1="0mm" width="185mm" height="17mm" id="footer" />
+    </pageTemplate>
+  </template>
+  <stylesheet>
+    <blockTableStyle id="headercompany">
+      <blockFont name="Helvetica" size="14"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockBottomPadding start="0,0" length="3mm" stop="-1,0"/>
+      <blockTextColor start="-1,1" stop="-1,-1" colorName="#FF8040"/>
+    </blockTableStyle>
+    <blockTableStyle id="headercharge">
+      <blockLeftPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockFont start="1,0" stop="1,-1" name="Helvetica-Bold" size="10"/>
+      <blockFont start="4,0" stop="4,-1" name="Helvetica-Bold" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockAlignment start="1,0" stop="1,-1" value="RIGHT"/>
+      <blockAlignment start="4,0" stop="4,-1" value="RIGHT"/>
+      <lineStyle start="0,0" kind="LINEABOVE" stop="-1,0" colorName="black"/>
+      <lineStyle start="0,2" kind="LINEBELOW" stop="-1,2" colorName="black"/>
+      </blockTableStyle><blockTableStyle id="middleline">
+      <lineStyle start="0,0" kind="LINEABOVE" stop="-1,0" colorName="black"/>
+    </blockTableStyle>
+    <blockTableStyle id="measuresummary">
+      <blockLeftPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockFont start="2,0" stop="2,-1" name="Helvetica-Bold" size="10"/>
+      <blockFont start="0,0" stop="0,1" name="Helvetica-Bold" size="10"/>
+      <blockFont start="0,4" stop="0,4" name="Helvetica-Bold" size="10"/>
+      <blockFont start="0,7" stop="0,7" name="Helvetica-Bold" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockAlignment start="2,0" stop="2,-1" value="RIGHT"/>
+      <blockTopPadding start="0,1" length="5mm" stop="-1,1"/>
+      <blockTopPadding start="0,4" length="5mm" stop="-1,4"/>
+      <blockTopPadding start="0,7" length="5mm" stop="-1,7"/>
+    </blockTableStyle>
+    <blockTableStyle id="footer">
+      <blockLeftPadding length="0mm"/>
+      <blockTopPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <lineStyle start="0,0" kind="LINEABOVE" stop="-1,0" colorName="black"/>
+      <blockAlignment start="4,0" stop="4,-1" value="RIGHT"/>
+    </blockTableStyle>
+
+  </stylesheet>
+  <story>
+    <spacer length="8mm"/>
+    <blockTable style="headercompany" colWidths="186mm">
+      <tr>
+        <td>G. Bopp + Co. AG, Bachmannweg 20, CH-8046 Zuerich</td>
+      </tr>
+      <tr><td>MASCHENWEITE PROTOKOLL</td></tr>
+      <tr><td>APERTURE MEASURING CERTIFICATE</td></tr>
+    </blockTable>
+    <spacer length="4mm"/>
+    <blockTable style="headercharge" colWidths="55mm, 34mm, 15mm, 40.5mm, 38mm">
+      <tr>
+        <td>Charge / Batch</td>
+        <td>111275</td>
+        <td/>
+        <td>Fert.Auftragsnr. / Prod.-No.</td>
+        <td>139354</td>
+      </tr>
+      <tr>
+        <td>Material 10457</td>
+        <td>w 1.120 mm / d 0.450 mm</td>
+        <td/>
+        <td>Werkstoff / Alloy</td>
+        <td>DIN 1.4401+4404 / AISI 316/L</td>
+      </tr>
+      <tr>
+        <td>Rollenbreite / Roll Width</td>
+        <td>1220 mm</td>
+        <td/>
+        <td>Geprueft nach / approved according to</td>
+        <td>ISO 3310</td>
+      </tr>
+    </blockTable>
+    <illustration width="166.8mm" height="150mm">
+      <chart dheight="59.97mm" joinedLines="1" dangle="0" dy="85.5mm" 
+            height="170" width="473" dx="14.5mm" x="0" y="0" charttype="LinePlot" 
+            strokeColor="black" dwidth="166.8mm">
+        <data dataset="[[(1, 1126.4000000000001), (2, 1127.0999999999999), (3, 1129.5), (4, 1134.0), (5, 1131.7), (6, 1140.2), (7, 1128.9000000000001), (8, 1128.9000000000001), (9, 1125.5), (10, 1124.7)], [(1, 1133.4000000000001), (2, 1116.7), (3, 1111.9000000000001), (4, 1118.9000000000001), (5, 1126.5), (6, 1120.9000000000001), (7, 1114.0), (8, 1139.5999999999999), (9, 1145.0), (10, 1146.5999999999999)]]"/>
+        <texts>
+          <text textAnchor="start" fontName="Helvetica" angle="-90" fontSize="10" 
+                fillColor="black" y="-1.5cm" x="-5.4cm" desc="Maschenweite / Aperture [um]"/>
+          <text textAnchor="start" fontName="Helvetica" angle="0" fontSize="10" 
+                fillColor="black" y="-0.9cm" x="4.7cm" desc="Anzahl Messungen / Number of measurements"/>
+        </texts>
+        <lines strokeWidth="0.5">
+          <line strokeColor="red" symbol="Circle"/>
+          <line strokeColor="blue" symbol="Square"/>
+        </lines>
+        <xValueAxis valueMin="1" strokeWidth="0.4" labelTextFormat="%2.0f" 
+            gridStrokeWidth="15" gridStrokeDashArray="[1,5]" gridStart="0" 
+            tickUp="170" valueStep="1" visibleGrid="0" gridStrokeColor="red" 
+            tickDown="0" strokeColor="black" gridEnd="10" valueMax="10">
+            <labels fontName="Helvetica"/>
+        </xValueAxis>
+        <yValueAxis valueMin="1042.5" strokeWidth="0.4" tickRight="473" 
+            tickLeft="0" gridStrokeDashArray="[1,5]" gridStart="100" 
+            gridStrokeColor="green" valueStep="20" labelTextFormat="%2.0f" 
+            visibleGrid="0" gridStrokeWidth="5" strokeColor="black" 
+            gridEnd="0" valueMax="1216">
+          <labels fontName="Helvetica"/>
+        </yValueAxis>
+      </chart>
+      <rotate degrees="0"/>
+      <chart dheight="59.97mm" joinedLines="1" dangle="0" dy="11.5mm" height="170" 
+            width="473" dx="14.5mm" x="0" y="0" charttype="LinePlot" strokeColor="black" 
+            dwidth="166.8mm">
+        <data dataset="[[(1, 16.300000000000001), (2, 16.300000000000001), (3, 16.300000000000001), (4, 16.199999999999999), (5, 16.199999999999999), (6, 16.199999999999999), (7, 16.300000000000001), (8, 16.300000000000001), (9, 16.300000000000001), (10, 16.300000000000001)], [(1, 16.199999999999999), (2, 16.300000000000001), (3, 16.300000000000001), (4, 16.300000000000001), (5, 16.199999999999999), (6, 16.199999999999999), (7, 16.300000000000001), (8, 16.0), (9, 16.0), (10, 16.0)]]"/>
+        <texts>
+          <text textAnchor="start" fontName="Helvetica" angle="-90" y="-1.5cm" 
+                x="-3.5cm" desc="Mesh" textColor="black" size="10"/>
+          <text textAnchor="start" fontName="Helvetica" angle="0" y="-0.9cm" 
+                x="4.7cm" desc="Anzahl Messungen / Number of measurements" 
+                textColor="black" size="10"/></texts>
+          <lines strokeWidth="0.5">
+            <line strokeColor="red" symbol="Circle"/>
+            <line strokeColor="blue" symbol="Square"/>
+          </lines>
+        <xValueAxis valueMin="1" strokeWidth="0.4" labelTextFormat="%2.0f" 
+            gridStrokeWidth="15" gridStrokeDashArray="[1,5]" gridStart="0" 
+            tickUp="170" valueStep="1" visibleGrid="0" gridStrokeColor="red" 
+            tickDown="0" strokeColor="black" gridEnd="10" valueMax="10">
+          <labels fontName="Helvetica"/>
+        </xValueAxis>
+        <yValueAxis valueMin="6" strokeWidth="0.4" tickRight="473" tickLeft="0" 
+            gridStrokeDashArray="[1,5]" gridStart="100" gridStrokeColor="green" 
+            valueStep="5" labelTextFormat="%2.0f" visibleGrid="0" gridStrokeWidth="5" 
+            strokeColor="black" gridEnd="0" valueMax="26.3">
+          <labels fontName="Helvetica"/>
+        </yValueAxis>
+      </chart>
+    </illustration>
+    <nextFrame/>
+    <blockTable style="middleline" colWidths="55mm, 34mm, 15mm, 40.5mm, 38mm">
+      <tr><td/><td/><td/><td/><td/></tr>
+    </blockTable>
+    <nextFrame/>
+    <illustration width="81.13mm" height="56.44mm">
+      <chart dheight="56.44mm" dangle="0" height="160" width="230" dx="14.0mm" 
+            x="0" y="0" charttype="VerticalBarChart" dy="-7.1mm" dwidth="81.13mm">
+        <data dataset="[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.3999999999999999, 9.0, 25.5, 30.0, 18.0, 7.7999999999999998, 0.0, 2.1000000000000001, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 2.3999999999999999, 3.7999999999999998, 5.7000000000000002, 7.0999999999999996, 10.6, 12.1, 14.699999999999999, 11.800000000000001, 6.0999999999999996, 8.5, 3.5, 4.0, 0.0, 0.0, 0.0]]"/>
+        <texts>
+          <text textAnchor="start" fontName="Helvetica-Bold" angle="0" y="5.9cm" 
+                x="0cm" desc="Haeufigkeitsverteilung / Histogramm" 
+                textColor="black" size="10"/>
+          <text textAnchor="start" fontName="Helvetica" angle="-90" y="-1.45cm" 
+                x="-5.8cm" desc="Anz. Maschen / No. of apertures in [%]" 
+                textColor="black" size="10"/>
+          <text textAnchor="start" fontName="Helvetica" angle="0" y="-1.3cm" 
+                x="1.7cm" desc="Maschenweite / Aperture [um]" textColor="black" size="10"/>
+        </texts>
+        <bars strokeWidth="0.5">
+          <bar fillColor="red"/>
+          <bar fillColor="blue"/>
+        </bars>
+        <valueAxis tickLeft="0" strokeColor="black" strokeWidth="1" visibleGrid="1" 
+            gridStrokeColor="black"><labels fontName="Helvetica"/>
+        </valueAxis>
+        <categoryAxis strokeColor="black" strokeWidth="1" 
+            categoryNames="['1040', '1050', '1060', '1070', '1080', '1090', '1100', '1110', '1120', '1130', '1140', '1150', '1160', '1170', '1180', '1190', '1200', '1210']">
+          <labels fontName="Helvetica" angle="90" dx="-5" dy="-12"/>
+        </categoryAxis>
+      </chart>
+    </illustration>
+    <nextFrame/>
+    <blockTable style="measuresummary" colWidths="7mm, 60mm, 12mm">
+      <tr><td>Messergebnisse Mittelwerte / Average Results:</td><td/><td/></tr>
+      <tr><td>Maschenweite / Aperture [um]</td><td/><td/></tr>
+      <tr>
+        <td>
+          <illustration width="10" height="10">
+            <fsimage y="0" width="10" x="0" file="../sample/dot_red.gif" height="10"/>
+          </illustration>
+        </td>
+        <td>Kette / Warp</td><td>1129.7</td>
+      </tr>
+      <tr>
+        <td>
+          <illustration width="10" height="10">
+            <fsimage y="0" width="10" x="0" file="../sample/dot_blue.gif" height="10"/>
+          </illustration>
+        </td>
+        <td>Schuss / Weft</td><td>1127.3</td></tr><tr><td>Mesh</td><td/><td/>
+      </tr>
+      <tr>
+        <td>
+          <illustration width="10" height="10">
+            <fsimage y="0" width="10" x="0" file="../sample/dot_red.gif" height="10"/>
+          </illustration>
+        </td>
+        <td>Kette / Warp</td><td>16.3</td>
+      </tr>
+      <tr>
+        <td>
+          <illustration width="10" height="10">
+            <fsimage y="0" width="10" x="0" file="../sample/dot_blue.gif" height="10"/>
+          </illustration>
+        </td>
+        <td>Schuss / Weft</td><td>16.2</td>
+      </tr>
+      <tr><td>Offene Siebflaeche / Open Area [%]</td><td/><td>52.0</td></tr>
+    </blockTable>
+    <nextFrame/>
+    <blockTable style="footer" colWidths="55mm, 34mm, 15mm, 40.5mm, 38mm">
+      <tr>
+        <td>Datum / Date: 05.01.2005</td>
+        <td/>
+        <td/>
+        <td>Pruefer / Inspector: Colner Davor</td>
+        <td>
+          <illustration width="25mm" height="9.5mm">
+            <fsimage y="-4mm" width="25mm" x="0mm" file="../sample/dcolner.gif" height="9.5mm"/>
+          </illustration>
+        </td>
+      </tr>
+    </blockTable>
+  </story>
+</document>
\ No newline at end of file


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/micromeshprot.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/pml_contents.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/pml_contents.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/pml_contents.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="iso-8859-15"?>
+<document 
+    xmlns:tal="http://xml.zope.org/namespaces/tal"
+    xmlns:metal="http://xml.zope.org/namespaces/metal"
+    filename="contents.pdf">
+<content>
+
+<para style="FolderName">
+  Folder Name:
+  <tal:block 
+     condition="context/__name__"
+     replace="context/__name__|default" />
+  <tal:block condition="not:context/__name__">&lt;no name&gt;</tal:block>
+</para>
+
+<spacer height="30" />
+
+<table splitbyrow="1" repeatrows="0" repeatcols="0" style="ContentTable">
+  <tr>
+    <td>Name</td>
+    <td>Title</td>
+    <td>Size</td>
+    <td>Created</td>
+    <td>Modified</td>
+  </tr>
+  <tr tal:repeat="item view/listContentInfo">
+    <td tal:content="item/id">me.png</td>
+    <td tal:content="item/title|default">&lt;no title&gt;</td>
+    <td tal:content="item/size/sizeForDisplay|nothing">34.5 kB</td>
+    <td tal:content="item/created|default"></td>
+    <td tal:content="item/modified|default"></td>
+  </tr>
+</table>
+
+<action name="frameEnd" />
+
+</content>
+</document>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/pml_contents.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/pml_template.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/pml_template.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/pml_template.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<template 
+    filename="contents.pdf"
+    pagesize="A4" 
+    landscape="0" 
+    showboundary="0"
+    leftmargin="1cm"
+    rightmargin="1cm"
+    topmargin="1cm"
+    bottommargin="1cm"
+    allowsplitting="1">
+
+  <stylesheet>
+
+   <paragraphstyle 
+       name="Base" 
+       fontName="Helvetica" 
+       fontSize="10" 
+       align="LEFT" 
+       firstLineIndent="0cm" 
+       leftIndent="0.5cm" 
+       rightIndent="0cm" 
+       spaceBefore="0" 
+       spaceAfter="0" 
+       leading="0.5cm" 
+       bulletFontName="Helvetica" 
+       bulletIndent="0cm" 
+       bulletFontSize="10" />
+
+   <paragraphstyle 
+       name="FolderName" 
+       parent="Base" 
+       leftIndent="0cm" 
+       fontName="Helvetica-Bold" 
+       fontSize="16" 
+       leading="0.5cm"
+       spaceBefore="4"
+       spaceAfter="4" />
+
+   <tablestyle name="ContentTable">
+     <stylecmd expr="('LEFTPADDING', (0,0), (-1,-1), 5)"/>
+     <stylecmd expr="('RIGHTPADDING', (0,0), (-1,-1), 5)"/>
+     <stylecmd expr="('TOPPADDING', (0,0), (-1,-1), 3)"/>
+     <stylecmd expr="('BOTTOMPADDING', (0,0), (-1,-1), 7)"/>
+     <stylecmd expr="('ALIGN', (0,0), (-1,-1), 'LEFT')"/>
+     <stylecmd expr="('GRID', (0,0), (-1,-1), 0.5, colors.black)"/>
+     <stylecmd expr="('BOX', (0,0), (-1,-1), 1, colors.black)"/>
+     <stylecmd expr="('FONT', (1,1), (-1,-1), 'Helvetica', 10)"/>
+     <stylecmd expr="('FONT', (0,0), (-1,0), 'Helvetica-Bold', 10)"/>
+     <stylecmd expr="('FONT', (0,1), (0,-1), 'Courier', 10)"/>
+   </tablestyle>
+
+  </stylesheet>
+
+
+  <pagetemplate id="Page" >
+    <static>
+      <infostring 
+          align="left" 
+          x="5cm" 
+          y="28cm" 
+          size="10"
+	  font="Helvetica" 
+          color="(0, 0, 0)">
+        The development of the PDF Template Code was sposored by Projekt01.
+      </infostring>
+    </static>	   
+
+    <frame 
+        id="content"
+   	nextid="content"
+    	x="2cm" 
+        y="1.5cm" 
+	width="17cm" 
+	height="25.5cm" 
+	leftpadding="0.1cm"
+	rightpadding="0.1cm"
+	toppadding="0.5cm"
+	bottompadding="0.5cm"
+	showBoundary="0" />
+  </pagetemplate>
+
+</template>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/pml_template.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/raylprot.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/raylprot.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/raylprot.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="rollcard.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+        <!-- showBoundary means that we will be able to see the   --> 
+        <!-- limits of frames                                     --> 
+
+    <pageTemplate id="main">
+      <pageGraphics>
+        <fsimage y="265mm" width="35.5mm" x="167mm" 
+            file="../sample/bopplogo.gif" height="25.6mm"/>
+      </pageGraphics>
+      <frame x1="15mm" y1="0mm" width="185mm" height="300mm" id="header" />
+      <frame x1="15mm" y1="87mm" width="185mm" height="11mm" id="middleline" />
+      <frame x1="15mm" y1="28mm" width="90mm" height="68mm" id="summary" />
+      <frame x1="110mm" y1="28mm" width="100mm" height="68mm" id="summary2" />
+      <frame x1="15mm" y1="0mm" width="185mm" height="17mm" id="footer" />
+    </pageTemplate>
+  </template>
+  <stylesheet>
+    <blockTableStyle id="headercompany">
+      <blockFont name="Helvetica" size="14"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockBottomPadding start="0,0" length="3mm" stop="-1,0"/>
+      <blockTextColor start="-1,1" stop="-1,-1" colorName="#FF8040"/>
+    </blockTableStyle>
+    <blockTableStyle id="headercharge">
+      <blockLeftPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockFont start="1,0" stop="1,-1" name="Helvetica-Bold" size="10"/>
+      <blockFont start="4,0" stop="4,-1" name="Helvetica-Bold" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockAlignment start="1,0" stop="1,-1" value="RIGHT"/>
+      <blockAlignment start="4,0" stop="4,-1" value="RIGHT"/>
+      <lineStyle start="0,0" kind="LINEABOVE" stop="-1,0" colorName="black"/>
+      <lineStyle start="0,2" kind="LINEBELOW" stop="-1,2" colorName="black"/>
+      </blockTableStyle><blockTableStyle id="middleline">
+      <lineStyle start="0,0" kind="LINEABOVE" stop="-1,0" colorName="black"/>
+    </blockTableStyle>
+    <blockTableStyle id="measuredetail">
+      <blockLeftPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockFont start="0,0" stop="-1,0" name="Helvetica-Bold" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockAlignment start="0,0" stop="0,-1" value="RIGHT"/>
+      <blockAlignment start="3,0" stop="3,-1" value="RIGHT"/>
+      <blockAlignment start="6,0" stop="6,-1" value="RIGHT"/>
+      <blockBottomPadding start="0,1" stop="-1,-1" length="-0.55mm" />
+    </blockTableStyle>
+    <blockTableStyle id="middleline">
+      <lineStyle start="0,0" kind="LINEABOVE" stop="-1,0" colorName="black"/>
+    </blockTableStyle>
+    <blockTableStyle id="measuresummary">
+      <blockLeftPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockFont start="2,0" stop="2,-1" name="Helvetica-Bold" size="10"/>
+      <blockFont start="0,0" stop="0,0" name="Helvetica-Bold" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockAlignment start="2,0" stop="2,-1" value="RIGHT"/>
+      <blockTopPadding start="0,1" length="5mm" stop="-1,1"/>
+    </blockTableStyle>
+    <blockTableStyle id="footer">
+      <blockLeftPadding length="0mm"/>
+      <blockTopPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <lineStyle start="0,0" kind="LINEABOVE" stop="-1,0" colorName="black"/>
+      <blockAlignment start="4,0" stop="4,-1" value="RIGHT"/>
+    </blockTableStyle>
+
+  </stylesheet>
+  <story>
+    <spacer length="8mm"/>
+    <blockTable style="headercompany" colWidths="186mm">
+      <tr>
+        <td>G. Bopp + Co. AG, Bachmannweg 20, CH-8046 Zuerich</td>
+      </tr>
+      <tr><td>RAYL PROTOKOLL</td></tr>
+      <tr><td>RAYL CERTIFICATE</td></tr>
+    </blockTable>
+    <spacer length="4mm"/>
+    <blockTable style="headercharge" colWidths="55mm, 34mm, 15mm, 40.5mm, 38mm">
+      <tr>
+        <td>Charge / Batch</td>
+        <td>111275</td>
+        <td/>
+        <td>Fert.Auftragsnr. / Prod.-No.</td>
+        <td>139354</td>
+      </tr>
+      <tr>
+        <td>Material 10457</td>
+        <td>w 1.120 mm / d 0.450 mm</td>
+        <td/>
+        <td>Werkstoff / Alloy</td>
+        <td>DIN 1.4401+4404 / AISI 316/L</td>
+      </tr>
+      <tr>
+        <td>Rollenbreite / Roll Width</td>
+        <td>1220 mm</td>
+        <td/>
+        <td>Geprueft nach / approved according to</td>
+        <td>Cust-Spec</td>
+      </tr>
+    </blockTable>
+    <blockTable style="measuredetail" colWidths="28.5mm, 5mm, 28.5mm, 28.5mm, 5mm, 28.5mm, 28.5mm, 5mm, 28.5mm">
+      <tr><td>AREA</td><td/><td>RAYL</td><td>AREA</td><td/><td>RAYL</td><td>AREA</td><td/><td>RAYL</td></tr>
+      <tr><td>1</td><td/><td>9.0</td><td>31</td><td/><td></td><td>61</td><td/><td></td></tr>
+      <tr><td>2</td><td/><td>9.0</td><td>32</td><td/><td></td><td>62</td><td/><td></td></tr>
+      <tr><td>3</td><td/><td>9.0</td><td>33</td><td/><td></td><td>63</td><td/><td></td></tr>
+      <tr><td>4</td><td/><td>9.0</td><td>34</td><td/><td></td><td>64</td><td/><td></td></tr>
+      <tr><td>5</td><td/><td>9.0</td><td>35</td><td/><td></td><td>65</td><td/><td></td></tr>
+      <tr><td>6</td><td/><td>9.0</td><td>36</td><td/><td></td><td>66</td><td/><td></td></tr>
+      <tr><td>7</td><td/><td>9.0</td><td>37</td><td/><td></td><td>67</td><td/><td></td></tr>
+      <tr><td>8</td><td/><td>9.0</td><td>38</td><td/><td></td><td>68</td><td/><td></td></tr>
+      <tr><td>9</td><td/><td>9.0</td><td>39</td><td/><td></td><td>69</td><td/><td></td></tr>
+      <tr><td>10</td><td/><td>9.0</td><td>40</td><td/><td></td><td>70</td><td/><td></td></tr>
+      <tr><td>11</td><td/><td>9.0</td><td>41</td><td/><td></td><td>71</td><td/><td></td></tr>
+      <tr><td>12</td><td/><td>9.0</td><td>42</td><td/><td></td><td>72</td><td/><td></td></tr>
+      <tr><td>13</td><td/><td>9.0</td><td>43</td><td/><td></td><td>73</td><td/><td></td></tr>
+      <tr><td>14</td><td/><td>9.0</td><td>44</td><td/><td></td><td>74</td><td/><td></td></tr>
+      <tr><td>15</td><td/><td>9.0</td><td>45</td><td/><td></td><td>75</td><td/><td></td></tr>
+      <tr><td>16</td><td/><td>9.0</td><td>46</td><td/><td></td><td>76</td><td/><td></td></tr>
+      <tr><td>17</td><td/><td>9.0</td><td>47</td><td/><td></td><td>77</td><td/><td></td></tr>
+      <tr><td>18</td><td/><td>9.0</td><td>48</td><td/><td></td><td>78</td><td/><td></td></tr>
+      <tr><td>19</td><td/><td>9.0</td><td>49</td><td/><td></td><td>79</td><td/><td></td></tr>
+      <tr><td>20</td><td/><td>9.0</td><td>50</td><td/><td></td><td>80</td><td/><td></td></tr>
+      <tr><td>21</td><td/><td>9.0</td><td>51</td><td/><td></td><td>81</td><td/><td></td></tr>
+      <tr><td>22</td><td/><td>9.0</td><td>52</td><td/><td></td><td>82</td><td/><td></td></tr>
+      <tr><td>23</td><td/><td>9.0</td><td>53</td><td/><td></td><td>83</td><td/><td></td></tr>
+      <tr><td>24</td><td/><td>9.0</td><td>54</td><td/><td></td><td>84</td><td/><td></td></tr>
+      <tr><td>25</td><td/><td>9.0</td><td>55</td><td/><td></td><td>85</td><td/><td></td></tr>
+      <tr><td>26</td><td/><td>9.0</td><td>56</td><td/><td></td><td>86</td><td/><td></td></tr>
+      <tr><td>27</td><td/><td>9.0</td><td>57</td><td/><td></td><td>87</td><td/><td></td></tr>
+      <tr><td>28</td><td/><td>9.0</td><td>58</td><td/><td></td><td>88</td><td/><td></td></tr>
+      <tr><td>29</td><td/><td>9.0</td><td>59</td><td/><td></td><td>89</td><td/><td></td></tr>
+      <tr><td>30</td><td/><td>9.0</td><td>60</td><td/><td></td><td>90</td><td/><td></td></tr>
+    </blockTable>
+    <nextFrame/>
+    <blockTable style="middleline" colWidths="55mm, 34mm, 15mm, 40.5mm, 38mm">
+      <tr><td/><td/><td/><td/><td/></tr>
+    </blockTable>
+    <nextFrame/>
+    <illustration width="81.13mm" height="56.44mm">
+      <chart dheight="56.44mm" dangle="0" height="160" width="230" dx="14.0mm" 
+            x="0" y="0" charttype="VerticalBarChart" dy="-7.1mm" dwidth="81.13mm">
+        <data dataset="[[0.0, 0.0, 0.0, 0.0, 0.0, 20.0, 64.0, 16.0, 0.0, 0.0, 0.0]]"/>
+        <texts>
+          <text textAnchor="start" fontName="Helvetica-Bold" angle="0" y="5.9cm" 
+                x="0cm" desc="Haeufigkeitsverteilung / Histogramm" 
+                textColor="black" size="10"/>
+          <text textAnchor="start" fontName="Helvetica" angle="-90" y="-1.45cm" 
+                x="-3.05cm" desc="in [%]" 
+                textColor="black" size="10"/>
+          <text textAnchor="start" fontName="Helvetica" angle="0" y="-1.3cm" 
+                x="3.5cm" desc="Rayl" textColor="black" size="10"/>
+        </texts>
+        <bars strokeWidth="0.5">
+          <bar fillColor="red"/>
+          <bar fillColor="blue"/>
+        </bars>
+        <valueAxis tickLeft="0" strokeColor="black" strokeWidth="1" visibleGrid="1" 
+            gridStrokeColor="black"><labels fontName="Helvetica"/>
+        </valueAxis>
+        <categoryAxis strokeColor="black" strokeWidth="1" 
+            categoryNames="['8.65', '8.70', '8.75', '8.80', '8.85', '8.90', '8.95', '9.00', '9.05', '9.10', '9.15']">
+          <labels fontName="Helvetica" angle="90" dx="-5" dy="-12"/>
+        </categoryAxis>
+      </chart>
+    </illustration>
+    <nextFrame/>
+    <blockTable style="measuresummary" colWidths="7mm, 60mm, 12mm">
+      <tr><td>Messergebnisse / Results:</td><td/><td/></tr>
+      <tr><td>Average</td><td/><td>8.95</td></tr>
+      <tr><td>Maximun</td><td/><td>9.00</td></tr>
+      <tr><td>Minimum</td><td/><td>8.89</td></tr>
+    </blockTable>
+    <nextFrame/>
+    <blockTable style="footer" colWidths="55mm, 34mm, 15mm, 40.5mm, 38mm">
+      <tr>
+        <td>Datum / Date: 05.01.2005</td>
+        <td/>
+        <td/>
+        <td>Pruefer / Inspector: Colner Davor</td>
+        <td>
+          <illustration width="25mm" height="9.5mm">
+            <fsimage y="-4mm" width="25mm" x="0mm" file="../sample/dcolner.gif" height="9.5mm"/>
+          </illustration>
+        </td>
+      </tr>
+    </blockTable>
+  </story>
+</document>
\ No newline at end of file


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/raylprot.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/replogo.gif
===================================================================
(Binary files differ)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/replogo.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rest.txt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rest.txt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rest.txt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,10 @@
+=========
+REST demo
+=========
+
+This is a rest demo use in the README.txt file.
+
+Subtitle
+--------
+
+This is a subtitle.


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rest.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rest_template.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rest_template.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rest_template.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,372 @@
+<?xml version="1.0" encoding="utf-8"?>
+<template 
+    xmlns:tal="http://xml.zope.org/namespaces/tal"
+    filename="default.pdf"
+    pagesize="A4" 
+    landscape="0" 
+    showboundary="0"
+    leftmargin="1cm"
+    rightmargin="1cm"
+    topmargin="1cm"
+    bottommargin="1cm"
+    allowsplitting="1">
+
+  <stylesheet>
+
+   <paragraphstyle 
+       name="Base" 
+       fontName="Helvetica" 
+       fontSize="10" 
+       align="LEFT" 
+       firstLineIndent="0cm" 
+       leftIndent="0.5cm" 
+       rightIndent="0cm" 
+       spaceBefore="0" 
+       spaceAfter="0" 
+       leading="0.5cm" 
+       bulletFontName="Helvetica" 
+       bulletIndent="0cm" 
+       bulletFontSize="10"
+       />
+
+   <paragraphstyle 
+       name="Normal" 
+       fontName="Helvetica" 
+       fontSize="10" 
+       leading="0.5cm"
+       />
+
+   <paragraphstyle 
+       name="DocInfo" 
+       parent="Base" 
+       spaceBefore="4" 
+       spaceAfter="4" 
+       leading="12" 
+       />
+
+   <paragraphstyle 
+       name="Comment" 
+       parent="Base" 
+       fontName="Helvetica-Italic" 
+       />
+
+   <paragraphstyle 
+       name="Indent1" 
+       parent="Base" 
+       leftIndent="36" 
+       firstLineIndent="0" 
+       />
+
+   <paragraphstyle 
+       name="BodyText" 
+       parent="Normal" 
+       spaceBefore="6" 
+       />
+
+   <paragraphstyle 
+       name="Italic" 
+       parent="BodyText" 
+       fontName="Helvetica-Italic" 
+       />
+
+   <paragraphstyle 
+       name="Heading" 
+       parent="Base" 
+       leftIndent="0cm" 
+       fontName="Helvetica-Bold" 
+       fontSize="16" 
+       leading="0.5cm"
+       spaceBefore="4"
+       spaceAfter="4" 
+       />
+
+   <paragraphstyle 
+       name="Heading1" 
+       parent="Heading"
+       leftIndent="0cm" 
+       fontName="Helvetica-Bold" 
+       fontSize="16"
+       leading="0.5cm" 
+       spaceBefore="4" 
+       spaceAfter="8" 
+       />
+
+   <!-- Alias 'h1' for 'Heading1' used by ReST Writer -->
+   <paragraphstyle 
+       name="h1" 
+       parent="Heading1"
+       />
+   
+   <paragraphstyle 
+       name="Heading2" 
+       parent="Base" 
+       leftIndent="0cm" 
+       fontName="Helvetica-Bold" 
+       fontSize="13" 
+       leading="0.5cm" 
+       spaceBefore="4"
+       spaceAfter="4"
+       />
+
+   <!-- Alias 'h2' for 'Heading2' used by ReST Writer -->
+   <paragraphstyle 
+       name="h2" 
+       parent="Heading2"
+       />
+
+   <paragraphstyle 
+       name="Heading3" 
+       parent="Base" 
+       leftIndent="0cm" 
+       fontName="Helvetica-BoldOblique" 
+       fontSize="12" 
+       leading="0.3cm" 
+       spaceBefore="4" 
+       spaceAfter="4"
+       />
+
+   <!-- Alias 'h3' for 'Heading3' used by ReST Writer -->
+   <paragraphstyle 
+       name="h3" 
+       parent="Heading3"
+       />
+
+   <paragraphstyle 
+       name="Heading4" 
+       parent="Base" 
+       leftIndent="0cm" 
+       fontName="Helvetica-BoldOblique" 
+       fontSize="10" 
+       leading="0.3cm" 
+       spaceBefore="4" 
+       spaceAfter="4" 
+       />
+
+   <!-- Alias 'h4' for 'Heading4' used by ReST Writer -->
+   <paragraphstyle 
+       name="h4" 
+       parent="Heading4"
+       />
+
+   <paragraphstyle 
+       name="Heading5" 
+       parent="Base" 
+       leftIndent="0cm" 
+       fontName="Helvetica-Bold" 
+       fontSize="10" 
+       leading="0.3cm" 
+       spaceBefore="4" 
+       spaceAfter="4" 
+       />
+
+   <!-- Alias 'h5' for 'Heading5' used by ReST Writer -->
+   <paragraphstyle 
+       name="h5" 
+       parent="Heading5"
+       />
+
+   <paragraphstyle 
+       name="Heading6" 
+       parent="Base" 
+       leftIndent="0cm" 
+       fontName="Helvetica-Bold" 
+       fontSize="8" 
+       leading="0.3cm" 
+       spaceBefore="4" 
+       spaceAfter="4" 
+       />
+
+   <!-- Alias 'h6' for 'Heading6' used by ReST Writer -->
+   <paragraphstyle 
+       name="h6" 
+       parent="Heading6"
+       />
+
+   <paragraphstyle 
+       name="Title"
+       parent="Heading" 
+       fontSize="22" 
+       spaceAfter="1.5cm"
+       alignment="center" 
+       />
+
+   <!-- Alias 'title' for 'Title' used by ReST Writer -->
+   <paragraphstyle 
+       name="title" 
+       parent="Title"
+       />
+
+   <paragraphstyle 
+       name="Subtitle"
+       parent="Heading" 
+       fontSize="20" 
+       spaceAfter="1.5cm"
+       alignment="center" 
+       />
+
+   <!-- Alias 'subtitle' for 'Subtitle' used by ReST Writer -->
+   <paragraphstyle 
+       name="subtitle" 
+       parent="Subtitle"
+       />
+
+   <paragraphstyle 
+       name="TopicTitle"
+       parent="Heading" 
+       fontSize="18" 
+       leading="14"
+       spaceAfter="6"
+       />
+
+   <!-- Alias 'topic-title' for 'TopicTitle' used by ReST Writer -->
+   <paragraphstyle 
+       name="topic-title" 
+       parent="TopicTitle"
+       />
+
+   <tal:block repeat="i python: range(15)">
+
+   <paragraphstyle 
+       name="TopicItem"
+       parent="Normal" 
+       fontSize="12" 
+       leftIndent="0"
+       spaceBefore="0"
+       spaceAfter="0"
+       tal:attributes="
+           name string:TopicItem$i;
+           leftIndent python:18*i"
+       />
+
+   <!-- Alias used by ReST Writer -->
+   <paragraphstyle 
+       name="topic-item" 
+       parent="TopicItems"
+       tal:attributes="
+           name string:topic-item-$i;       
+           parent string:TopicItem$i;"
+       />
+
+   </tal:block>
+
+   <paragraphstyle 
+       name="UnorderedList" 
+       parent="Normal"
+       firstLineIndent="0" 
+       leftIndent="18"
+       spaceBefore="0"
+       bulletFontName="Symbol"
+       bulletIndent="9"
+       />
+
+   <!-- Alias 'ul' for 'UnorderedList' used by ReST Writer -->
+   <paragraphstyle 
+       name="ul" 
+       parent="UnorderedList"
+       />
+
+   <paragraphstyle 
+       name="Definition"
+       parent="Normal"
+       firstLineIndent="0" 
+       leftIndent="36"
+       spaceBefore="2"
+       spaceAfter="2"
+       bulletFontName="Helvetica-BoldOblique"
+       bulletIndent="0"
+       />
+
+   <!-- Alias 'dl' for 'Definition' used by ReST Writer -->
+   <paragraphstyle 
+       name="dl" 
+       parent="Definition"
+       />
+
+   <paragraphstyle 
+       name="OrderedList" 
+       parent="Definition"
+       />
+
+   <!-- Alias 'ol' for 'OrderedList' used by ReST Writer -->
+   <paragraphstyle 
+       name="ol" 
+       parent="OrderedList"
+       />
+
+   <paragraphstyle 
+       name="Code" 
+       parent="Normal"
+       fontName="Courier"
+       textColor="navy"
+       leading="8.8"
+       leftIndent="36"
+       firstLineIndent="0"
+       spaceBefore="5"
+       spaceAfter="10"
+       />
+
+   <paragraphstyle 
+       name="FunctionHeader"
+       parent="Normal"
+       fontName="Courier-Bold"
+       fontSize="8"
+       leading="8.8"
+       />
+
+   <paragraphstyle 
+       name="DocString"
+       parent="Normal"
+       fontName="Courier"
+       fontSize="8"
+       leftIndent="18"
+       leading="8.8"
+       />
+
+   <paragraphstyle 
+       name="DocStringIndent"
+       parent="Normal"
+       fontName="Courier"
+       fontSize="8"
+       leftIndent="36"
+       leading="8.8"
+       />
+
+   <paragraphstyle
+       name="URL" 
+       parent="Normal"
+       fontName="Courier"
+       textColor="navy"
+       alignment="center"
+       />
+
+   <paragraphstyle
+       name="Centered" 
+       parent="Normal"
+       alignment="center"
+       />
+
+   <paragraphstyle
+       name="Caption"
+       parent="Centered"
+       fontName="Helvetica-Italic"
+       />
+
+  </stylesheet>
+
+  <pagetemplate id="Page" >
+    <frame 
+        id="content"
+   	nextid="content"
+    	x="2cm" 
+        y="1.5cm" 
+	width="17cm" 
+	height="25.5cm" 
+	leftpadding="0.1cm"
+	rightpadding="0.1cm"
+	toppadding="0.5cm"
+	bottompadding="0.5cm"
+	showBoundary="0" 
+        />
+  </pagetemplate>
+
+</template>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rest_template.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rml_contents.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rml_contents.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rml_contents.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="rollcard.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+        <!-- showBoundary means that we will be able to see the   --> 
+        <!-- limits of frames                                     --> 
+
+	<pageTemplate id="main">
+	<pageGraphics>
+		<!-- set the font and fill colour for the title. -->
+		<fill color="red"/>
+		<setFont name="Helvetica" size="24"/>
+		<!-- Use drawCentredString to place a title on the page -->
+		<drawCentredString x="297.5" y="800">
+			Simple Text and Graphics with RML.
+		</drawCentredString>
+		<fill color="red"/>
+		<!-- look at the output - though a fill color is set, no fill -->
+		<!-- is produced, since fill is set to "no" for the circle	-->
+		<circle x="127.5" y="672.75" radius="1 in" fill="no" stroke="yes"/>
+		<fill color="green"/>
+		<stroke color="black"/>
+		<circle x="297.5" y="672.75" radius="1 in" fill="yes" stroke="no"/>
+		<fill color="blue"/>
+		<stroke color="black"/>
+		<circle x="467.5" y="672.75" radius="1 in" fill="yes" stroke="yes"/>
+		<fill color="black"/>
+		<setFont name="Helvetica" size="9"/>
+		<drawCentredString x="127.5" y="567.5">
+			Circle - with stroke, but no fill.
+		</drawCentredString>
+		<drawCentredString x="297.5" y="567.5">
+			Circle - with fill, but no stroke.
+		</drawCentredString>
+		<drawCentredString x="467.5" y="567.5">
+			Circle - with both stroke and fill.
+		</drawCentredString>
+		<fill color="red"/>
+		<ellipse x="77" y="382.25" width="177" height="552.25" fill="no" stroke="yes"/>
+		<fill color="green"/>
+		<stroke color="black"/>
+		<ellipse x="247" y="382.25" width="347" height="552.25" fill="yes" stroke="no"/>
+		<fill color="blue"/>
+		<stroke color="black"/>
+		<ellipse x="417" y="382.25" width="507" height="552.25" fill="yes" stroke="yes"/>
+		<fill color="black"/>
+		<drawCentredString x="127.5" y="357">
+			Ellipse - with stroke, but no fill.
+		</drawCentredString>
+		<drawCentredString x="297.5" y="357">
+			Ellipse - with fill, but no stroke.
+		</drawCentredString>
+		<drawCentredString x="467.5" y="357">
+			Ellipse - with both stroke and fill.
+		</drawCentredString>
+		<rect x="84.5" y="214.3" width="1 in" height="1.15 in" fill="no" stroke="yes"/>
+		<fill color="green"/>
+		<stroke color="black"/>
+		<rect x="254.5" y="214.3" width="1 in" height="1.15 in" fill="yes" stroke="no"/>
+		<fill color="blue"/>
+		<stroke color="black"/>
+		<rect x="424.5" y="214.3" width="1 in" height="1.15 in" fill="yes" stroke="yes"/>
+		<fill color="black"/>
+		<drawCentredString x="127.5" y="199.1">
+			Rect - with stroke, but no fill.
+		</drawCentredString>
+		<drawCentredString x="297.5" y="199.1">
+			Rect - with fill, but no stroke.
+		</drawCentredString>
+		<drawCentredString x="467.5" y="199.1">
+			Rect - with both stroke and fill.
+		</drawCentredString>
+		<rect x="84.5" y="56.5" width="1 in" height="1.15 in" fill="no" stroke="yes" round="0.15 in"/>
+		<fill color="green"/>
+		<stroke color="black"/>
+		<rect x="254.5" y="56.5" width="1 in" height="1.15 in"
+			fill="yes" stroke="no" round="0.15 in"/>
+		<fill color="blue"/>
+		<stroke color="black"/>
+		<rect x="424.5" y="56.5" width="1 in" height="1.15 in"
+			fill="yes" stroke="yes" round="0.15 in"/>
+		<fill color="black"/>
+		<drawCentredString x="127.5" y="41.25">
+			Rect - with stroke and round, but no fill.
+		</drawCentredString>
+		<drawCentredString x="297.5" y="41.25">
+			Rect - with fill and round, but no stroke.
+		</drawCentredString>
+		<drawCentredString x="467.5" y="41.25">
+			Rect - with stroke, fill and round.
+		</drawCentredString>
+	</pageGraphics>
+	<frame id="first" x1="0.5in" y1="0.5in" width="20cm"
+			height="28cm"/>
+	</pageTemplate>
+</template>
+<stylesheet>
+</stylesheet>
+<story>
+<para></para>
+</story>
+</document>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rml_contents.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rollcard.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rollcard.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rollcard.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,548 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="rollcard.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+        <!-- showBoundary means that we will be able to see the   --> 
+        <!-- limits of frames                                     --> 
+
+    <pageTemplate id="main">
+      <frame x1="12mm" y1="0mm" width="190mm" height="300mm" id="text" />
+      <frame x1="109mm" y1="0mm" width="87mm" height="241.6mm" id="mirror" />
+      <frame x1="107mm" y1="12.1mm" width="89mm" height="228mm" id="mirrorfill" />
+    </pageTemplate>
+  </template>
+  <stylesheet>
+    <blockTableStyle id="headerroll">
+      <blockFont name="Helvetica" size="8"/>
+      <blockFont start="0,1" stop="-1,1" name="Helvetica-Bold" size="16"/>
+      <blockAlignment start="0,0" stop="-1,-1" value="CENTER"/>
+      <blockAlignment start="0,1" stop="0,1" value="LEFT"/>
+      <blockAlignment start="1,1" stop="-1,1" value="RIGHT"/>
+      <lineStyle start="1,0" kind="GRID" stop="-1,-1" colorName="black"/>
+      <blockBottomPadding start="0,1" length="3mm" stop="-1,1"/>
+    </blockTableStyle>
+    <blockTableStyle id="headerroll2">
+      <blockFont name="Helvetica" size="8"/>
+      <blockAlignment start="0,0" stop="-1,-1" value="LEFT"/>
+      <lineStyle start="0,0" kind="GRID" stop="2,0" colorName="black"/>
+      <lineStyle start="3,0" kind="OUTLINE" stop="4,0" colorName="black"/>
+      <lineStyle start="0,1" kind="GRID" stop="-1,4" colorName="black"/>
+      <lineStyle start="0,5" kind="GRID" stop="2,5" colorName="black"/>
+      <lineStyle start="3,5" kind="OUTLINE" stop="4,5" colorName="black"/>
+      <blockBottomPadding start="0,0" length="1mm" stop="-1,-1"/>
+    </blockTableStyle>
+    <blockTableStyle id="matlegend">
+        <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="8"/>
+        <blockFont start="0,0" stop="-1,0" name="Helvetica-Bold" size="9"/>
+        <blockFont start="0,1" stop="0,1" name="Helvetica-Bold" size="8"/>
+        <blockFont start="0,8" stop="0,8" name="Helvetica-Bold" size="8"/>
+        <blockFont start="0,17" stop="1,17" name="Helvetica-Bold" size="8"/>
+        <blockAlignment start="0,0" stop="-1,-1" value="LEFT"/>
+        <lineStyle start="0,0" kind="OUTLINE" stop="4,-1" colorName="black"/>
+        <lineStyle start="2,0" kind="LINEAFTER" stop="2,-1" colorName="black"/>
+        <lineStyle start="1,3" kind="LINEBELOW" stop="1,6" colorName="black"/>
+        <lineStyle start="1,9" kind="LINEBELOW" stop="1,12" colorName="black"/>
+        <lineStyle start="1,14" kind="LINEBELOW" stop="1,16" colorName="black"/>
+        <lineStyle start="0,16" kind="LINEBELOW" stop="0,16" colorName="black"/>
+        <lineStyle start="2,16" kind="LINEBELOW" stop="2,16" colorName="black"/>
+        <blockBottomPadding start="0,0" length="-0.5mm" stop="-1,-1"/>
+    </blockTableStyle>
+    <blockTableStyle id="matquality">
+        <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="8"/>
+        <blockFont start="0,0" stop="-1,0" name="Helvetica-Bold" size="9"/>
+        <blockFont start="0,10" stop="-1,10" name="Helvetica-Bold" size="9"/>
+        <blockFont start="1,0" stop="-1,-1" name="Helvetica" size="6"/>
+        <blockAlignment start="0,0" stop="-1,-1" value="LEFT"/>
+        <blockAlignment start="1,0" stop="-1,-1" value="CENTER"/>
+	<blockValign start="0,0" stop="0,-1" value="TOP" />
+        <lineStyle start="0,0" kind="OUTLINE" stop="5,-1" colorName="black"/>
+        <lineStyle start="0,0" kind="LINEBELOW" stop="5,5" colorName="black"/>
+        <lineStyle start="0,8" kind="LINEBELOW" stop="5,-1" colorName="black"/>
+        <blockBottomPadding start="0,10" length="30mm" stop="-1,10"/>
+    </blockTableStyle>
+    <paraStyle name="psmall" 
+      fontName="Helvetica" 
+      fontSize="6"
+      alignment="center" />
+    <blockTableStyle id="footer">
+      <blockFont name="Helvetica" size="9"/>
+      <lineStyle start="0,0" kind="OUTLINE" stop="-1,-1" colorName="black"/>
+      <blockTopPadding start="0,0" length="-2mm" stop="-1,-1"/>
+      <blockAlignment start="0,0" stop="-1,-1" value="LEFT"/>
+      <blockBottomPadding start="0,0" length="4mm" stop="-1,-1"/>
+    </blockTableStyle>
+    <blockTableStyle id="mirror">
+      <blockFont name="Helvetica" size="9"/>
+      <lineStyle start="0,0" kind="OUTLINE" stop="-1,-1" colorName="black"/>
+      <lineStyle start="0,0" kind="LINEBELOW" stop="0,-1" colorName="black"/>
+      <lineStyle start="2,0" kind="LINEBELOW" stop="3,-1" colorName="black"/>
+      <lineStyle start="5,0" kind="LINEBELOW" stop="6,-1" colorName="black"/>
+      <lineStyle start="8,0" kind="LINEBELOW" stop="8,-1" colorName="black"/>
+      <lineStyle start="2,0" kind="LINEAFTER" stop="2,-1" colorName="black"/>
+      <lineStyle start="5,0" kind="LINEAFTER" stop="5,-1" colorName="black"/>
+      <lineStyle start="8,0" kind="LINEAFTER" stop="8,-1" colorName="black"/>
+      <blockBottomPadding start="0,0" length="-1.8mm" stop="-1,-1"/>
+      <blockTopPadding start="0,0" length="7.95mm" stop="-1,-1"/>
+      <blockAlignment start="0,0" stop="-1,-1" value="CENTER"/>
+
+    </blockTableStyle>
+
+  </stylesheet>
+  <story>
+    <spacer length="6mm"/>
+    <blockTable style="headerroll" colWidths="91mm, 29mm, 29mm, 29mm">
+      <tr>
+        <td/>
+        <td>Charge</td>
+        <td>lfm</td>
+        <td>DIN WerkStoff</td>
+      </tr>
+      <tr>
+        <td>Rollenkarte</td>
+        <td>268574</td>
+        <td>30.50</td>
+        <td>1.4401</td>
+      </tr>
+    </blockTable>
+    <blockTable style="headerroll2" colWidths="45.5mm, 45.5mm, 45.5mm, 21mm, 20.5mm">
+      <tr>
+        <td>Chargen-Nr.</td>
+        <td>Webart</td>
+        <td>Werkstoff</td>
+        <td>Maschinen-Nr.</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>Material-Nr.</td>
+        <td>Maschen Kette   /zoll</td>
+        <td>Fertigungsauftrags-Nr.</td>
+        <td>SD</td>
+	<td>SDC</td>
+      </tr>
+      <tr>
+        <td>Mesh Kette      mm</td>
+        <td>Maschen Schuss  /zoll</td>
+        <td>Gewicht     kg</td>
+        <td>GP</td>
+	<td>SDS</td>
+      </tr>
+      <tr>
+        <td>Mesh Schuss     mm</td>
+        <td>SAP-Nr.</td>
+        <td>Laenge     m</td>
+        <td>PS</td>
+	<td>SDSC</td>
+      </tr>
+      <tr>
+        <td>Draht Kette     mm</td>
+        <td>Low Carbon LC</td>
+        <td>Breite      mm</td>
+        <td>SI</td>
+	<td>SD-Plus</td>
+      </tr>
+      <tr>
+        <td>Draht Schuss      mm</td>
+        <td>xxx</td>
+        <td>Flaeche m2</td>
+        <td>Visum Kontrolle</td>
+	<td/>
+      </tr>
+    </blockTable>
+
+    <blockTable style="matlegend" colWidths="20mm, 21.5mm, 4mm, 31mm, 14.5mm, 87mm">
+      <tr>
+        <td>Material-Herkunft:</td>
+        <td/>
+        <td/>
+        <td>Legende:</td>
+	<td/>
+	<td/>
+      </tr>
+      <tr>
+        <td>Kettdraht</td>
+        <td/>
+        <td/>
+        <td>Druckstelle</td>
+	<td>DS</td>
+	<td/>
+      </tr>
+      <tr>
+        <td/>
+        <td/>
+        <td/>
+        <td>Einleger </td>
+	<td>E /mm</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>Lieferant</td>
+        <td/>
+        <td/>
+        <td>Falten</td>
+	<td>F /mm</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>Draht Art.-Nr.</td>
+        <td/>
+        <td/>
+        <td>Eingewebte Fremdk.</td>
+	<td>FK /mm</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>SAP-Schm.-Nr.</td>
+        <td/>
+        <td/>
+        <td>Flickstelle</td>
+	<td>FS /mm</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>Schmelze</td>
+        <td/>
+        <td/>
+        <td>Kantenriss</td>
+	<td>KA /mm</td>
+	<td/>
+      </tr>
+      <tr>
+        <td/>
+        <td/>
+        <td/>
+        <td>Kettbruch</td>
+	<td>KE /mm</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>Schussdraht</td>
+        <td/>
+        <td/>
+        <td>Kammgasse</td>
+	<td>KG /mm</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>Lieferant</td>
+        <td/>
+        <td/>
+        <td>Knickerschuss</td>
+	<td>KN</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>Draht Art.-Nr.</td>
+        <td/>
+        <td/>
+        <td>Lockerer Kettdraht</td>
+	<td>LK /mm</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>SAP-Schm.-Nr.</td>
+        <td/>
+        <td/>
+        <td>Lichte Stelle</td>
+	<td>LS /mm</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>Schmelze</td>
+        <td/>
+        <td/>
+        <td>Nadelloecher</td>
+	<td>NL /mm</td>
+	<td/>
+      </tr>
+      <tr>
+        <td/>
+        <td/>
+        <td/>
+        <td>Oesen</td>
+	<td>O</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>Lieferant alt</td>
+        <td/>
+        <td/>
+        <td>Regulierstelle</td>
+	<td>RS</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>Schussdraht neu</td>
+        <td/>
+        <td/>
+        <td>Schussbruch</td>
+	<td>S /mm</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>Ab Meter</td>
+        <td/>
+        <td/>
+        <td>Schlingerschuss</td>
+	<td>SL</td>
+	<td/>
+      </tr>
+      <tr>
+        <td>Lagerplatz</td>
+        <td>      Lagercode</td>
+        <td/>
+        <td>Weite Stelle</td>
+	<td>WS /mm</td>
+	<td/>
+      </tr>
+      <tr>
+        <td></td>
+        <td></td>
+        <td/>
+        <td>Zerschlagener Schuss</td>
+	<td>ZS /mm</td>
+	<td/>
+      </tr>
+    </blockTable>
+
+
+    <blockTable style="matquality" colWidths="38.5mm, 10.5mm, 10.5mm, 10.5mm, 10.5mm, 10.5mm, 87mm">
+      <tr>
+	<td>Qualitaets-Vermerke</td>
+	<td/>
+	<td/>
+	<td/>
+	<td/>
+	<td/>
+	<td/>
+      </tr>
+      <tr>
+	<td>Sauberkeit</td>
+	<td>
+          <para style="psmall">sauber</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">leicht-schmutzig</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">schmutzig</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>	
+	<td/>
+      </tr>
+      <tr>
+	<td>Webfehler</td>
+	<td>
+          <para style="psmall">wenig-od.-keine</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">einige</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">viele</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>	
+	<td/>
+      </tr>
+      <tr>
+	<td>Gewebe-Bindung</td>
+	<td>
+          <para style="psmall">gut</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">mittel</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">lose</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>	
+	<td/>
+      </tr>
+      <tr>
+	<td>Planlage</td>
+	<td>
+          <para style="psmall">sauber</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">leicht-schmutzig</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">schmutzig</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>	
+	<td/>
+      </tr>
+      <tr>
+	<td>Farbe</td>
+	<td>
+          <para style="psmall">hell</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">dunkel</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">unregelm.</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>	
+	<td/>
+      </tr>
+      <tr>
+	<td>Regelmaessigkeit</td>
+	<td/>
+	<td/>
+	<td/>
+	<td/>
+	<td/>
+      </tr>      
+      <tr>
+	<td>   Schuss</td>
+	<td>
+          <para style="psmall">gut</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">streifig</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">gassig</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>	
+	<td/>
+      </tr>      
+      <tr>
+	<td>   Kette</td>
+	<td>
+          <para style="psmall">gut</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">streifig</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+	<td>
+          <para style="psmall">gassig</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+      </tr>
+      <tr>
+	<td>Allgemein</td>
+	<td>
+	  <para style="psmall">gut</para>
+	  <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td>
+	  <para style="psmall">-</para> 
+          <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td>
+	  <para style="psmall">mittel</para> 
+          <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td>
+	  <para style="psmall">-</para> 
+          <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td>
+	  <para style="psmall">schlecht</para> 
+          <illustration width="10" height="10"><fsimage file="../sample/box.gif" x="0" y="0"  width="10" height="10"/></illustration>
+	</td>
+	<td/>
+      </tr>
+      <tr>
+	<td>Bemerkung</td>
+	<td></td>
+	<td/>
+	<td></td>
+	<td/>
+	<td></td>
+	<td/>
+      </tr>
+    </blockTable>
+    <blockTable style="footer" colWidths="91mm, 62mm, 25mm">
+      <tr>
+        <td>Datum / Date: 05.01.2005</td>
+        <td>Pruefer / Inspector: Colner Davor</td>
+        <td>
+          <illustration width="25mm" height="9.5mm">
+            <fsimage y="-4mm" width="25mm" x="0mm" file="../sample/dcolner.gif" height="9.5mm"/>
+          </illustration>
+        </td>
+      </tr>
+    </blockTable>
+    <nextFrame />
+    <blockTable style="mirror" colWidths="10mm, 9mm, 10mm, 10mm, 9mm, 10mm, 10mm, 9mm, 10mm">
+      <tr><td/><td>1</td><td/><td/><td>21</td><td/><td/><td>41</td><td/></tr>
+      <tr><td/><td>2</td><td/><td/><td>22</td><td/><td/><td>42</td><td/></tr>
+      <tr><td/><td>3</td><td/><td/><td>23</td><td/><td/><td>43</td><td/></tr>
+      <tr><td/><td>4</td><td/><td/><td>24</td><td/><td/><td>44</td><td/></tr>
+      <tr><td/><td>5</td><td/><td/><td>25</td><td/><td/><td>45</td><td/></tr>
+      <tr><td/><td>6</td><td/><td/><td>26</td><td/><td/><td>46</td><td/></tr>
+      <tr><td/><td>7</td><td/><td/><td>27</td><td/><td/><td>47</td><td/></tr>
+      <tr><td/><td>8</td><td/><td/><td>28</td><td/><td/><td>48</td><td/></tr>
+      <tr><td/><td>9</td><td/><td/><td>29</td><td/><td/><td>49</td><td/></tr>
+      <tr><td/><td>10</td><td/><td/><td>30</td><td/><td/><td>50</td><td/></tr>
+      <tr><td/><td>11</td><td/><td/><td>31</td><td/><td/><td>51</td><td/></tr>
+      <tr><td/><td>12</td><td/><td/><td>32</td><td/><td/><td>52</td><td/></tr>
+      <tr><td/><td>13</td><td/><td/><td>33</td><td/><td/><td>53</td><td/></tr>
+      <tr><td/><td>14</td><td/><td/><td>34</td><td/><td/><td>54</td><td/></tr>
+      <tr><td/><td>15</td><td/><td/><td>35</td><td/><td/><td>55</td><td/></tr>
+      <tr><td/><td>16</td><td/><td/><td>36</td><td/><td/><td>56</td><td/></tr>
+      <tr><td/><td>17</td><td/><td/><td>37</td><td/><td/><td>57</td><td/></tr>
+      <tr><td/><td>18</td><td/><td/><td>38</td><td/><td/><td>58</td><td/></tr>
+      <tr><td/><td>19</td><td/><td/><td>39</td><td/><td/><td>59</td><td/></tr>
+      <tr><td/><td>20</td><td/><td/><td>40</td><td/><td/><td>60</td><td/></tr>
+      <tr><td/><td></td><td/><td/><td></td><td/><td/><td></td><td/></tr>
+    </blockTable>
+    <nextFrame />
+    <illustration width="90mm" height="216.3mm">
+      <stroke color="black"/> 
+      <fill color="blue"/>  
+      <setFont name="Helvetica" size="8"/>
+
+      <rect x="0mm" y="0mm" width="10mm" height="10mm" fill="yes" stroke="no"/> 
+      <rect x="0mm" y="214.6mm" width="3mm" height="3mm" fill="yes" stroke="no"/> 
+      <rect x="76.7mm" y="0mm" width="10mm" height="10mm" fill="yes" stroke="no"/> 
+      <rect x="76.7mm" y="207.6mm" width="10mm" height="10mm" fill="yes" stroke="no"/> 
+      <rect x="76.7mm" y="207.6mm" width="10mm" height="10mm" fill="yes" stroke="no"/> 
+      <circle x="5mm" y="210mm" radius="1mm" fill="yes" stroke="no"/> 
+      <drawString x="7mm" y="209mm">DS</drawString>
+      <rect x="0mm" y="200mm" width="29mm" height="0.5mm" fill="yes" stroke="no"/> 
+      <drawString x="26mm" y="201mm">S</drawString>
+      
+
+    </illustration>
+  </story>
+</document>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/rollcard.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/screenshot.jpg
===================================================================
(Binary files differ)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/screenshot.jpg
___________________________________________________________________
Name: svn:mime-type
   + image/jpeg

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/thicknessprot.pt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/thicknessprot.pt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/thicknessprot.pt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="rollcard.pdf"> 
+<template pageSize="(210mm, 297mm)" 
+        leftMargin="12mm" 
+        rightMargin="10mm" 
+        topMargin="10mm" 
+        bottomMargin="10mm" 
+        title="Example 5 - templates and pageTemplates" 
+        author="Reportlab Inc (Documentation Team)" 
+        showBoundary="0" 
+        > 
+        <!-- showBoundary means that we will be able to see the   --> 
+        <!-- limits of frames                                     --> 
+
+    <pageTemplate id="main">
+      <pageGraphics>
+        <fsimage y="265mm" width="35.5mm" x="167mm" 
+            file="../sample/bopplogo.gif" height="25.6mm"/>
+      </pageGraphics>
+      <frame x1="15mm" y1="220mm" width="185mm" height="80mm" id="header" />
+      <frame x1="15mm" y1="28mm" width="90.2mm" height="210mm" id="summary" />
+      <frame x1="96mm" y1="28mm" width="100mm" height="210mm" id="summary2" />
+      <frame x1="15mm" y1="0mm" width="185mm" height="17mm" id="footer" />
+    </pageTemplate>
+  </template>
+  <stylesheet>
+    <blockTableStyle id="headercompany">
+      <blockFont name="Helvetica" size="14"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockBottomPadding start="0,0" length="3mm" stop="-1,0"/>
+      <blockTextColor start="-1,1" stop="-1,-1" colorName="#FF8040"/>
+    </blockTableStyle>
+    <blockTableStyle id="headercharge">
+      <blockLeftPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockFont start="1,0" stop="1,-1" name="Helvetica-Bold" size="10"/>
+      <blockFont start="4,0" stop="4,-1" name="Helvetica-Bold" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockAlignment start="1,0" stop="1,-1" value="RIGHT"/>
+      <blockAlignment start="4,0" stop="4,-1" value="RIGHT"/>
+      <lineStyle start="0,0" kind="LINEABOVE" stop="-1,0" colorName="black"/>
+      <lineStyle start="0,2" kind="LINEBELOW" stop="-1,2" colorName="black"/>
+      </blockTableStyle><blockTableStyle id="middleline">
+      <lineStyle start="0,0" kind="LINEABOVE" stop="-1,0" colorName="black"/>
+    </blockTableStyle>
+    <blockTableStyle id="measuresummary">
+      <blockLeftPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockFont start="1,0" stop="1,-1" name="Helvetica-Bold" size="10"/>
+      <blockFont start="0,0" stop="0,0" name="Helvetica-Bold" size="10"/>
+      <blockFont start="0,11" stop="0,-1" name="Helvetica-Bold" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockAlignment start="1,0" stop="1,-1" value="RIGHT"/>
+      <blockTopPadding start="0,1" stop= "-1,1" length="3mm" />
+      <blockTopPadding start="0,3" stop= "-1,3" length="3mm" />
+      <blockTopPadding start="0,5" stop= "-1,5" length="3mm" />
+      <blockTopPadding start="0,7" stop= "-1,7" length="3mm" />
+    </blockTableStyle>
+    <blockTableStyle id="measuresummary2">
+      <blockLeftPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockTopPadding start="0,0" stop= "-1,0" length="24mm" />
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica-Bold" size="10"/>
+    </blockTableStyle>
+    <blockTableStyle id="measuredetails">
+      <blockLeftPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockFont start="0,0" stop="-1,1" name="Helvetica-Bold" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <blockAlignment start="0,1" stop="-1,-1" value="RIGHT"/>
+      <blockTopPadding start="0,1" stop= "-1,1" length="3mm" />
+      <blockBottomPadding start="0,1" stop="-1,-1" length="-0.55mm" />
+    </blockTableStyle>
+    <blockTableStyle id="footer">
+      <blockLeftPadding length="0mm"/>
+      <blockTopPadding length="0mm"/>
+      <blockRightPadding length="0mm"/>
+      <blockFont start="0,0" stop="-1,-1" name="Helvetica" size="10"/>
+      <blockAlignment start="-1,0" stop="-1,-1" value="LEFT"/>
+      <lineStyle start="0,0" kind="LINEABOVE" stop="-1,0" colorName="black"/>
+      <blockAlignment start="4,0" stop="4,-1" value="RIGHT"/>
+    </blockTableStyle>
+
+  </stylesheet>
+  <story>
+    <spacer length="8mm"/>
+    <blockTable style="headercompany" colWidths="186mm">
+      <tr>
+        <td>G. Bopp + Co. AG, Bachmannweg 20, CH-8046 Zuerich</td>
+      </tr>
+      <tr><td>DICKENMESS PROTOKOLL</td></tr>
+      <tr><td>THICKNESS MEASURING CERTIFICATE</td></tr>
+    </blockTable>
+    <spacer length="4mm"/>
+    <blockTable style="headercharge" colWidths="55mm, 34mm, 15mm, 40.5mm, 38mm">
+      <tr>
+        <td>Charge / Batch</td>
+        <td>111275</td>
+        <td/>
+        <td>Fert.Auftragsnr. / Prod.-No.</td>
+        <td>139354</td>
+      </tr>
+      <tr>
+        <td>Material 10457</td>
+        <td>w 1.120 mm / d 0.450 mm</td>
+        <td/>
+        <td>Werkstoff / Alloy</td>
+        <td>DIN 1.4401+4404 / AISI 316/L</td>
+      </tr>
+      <tr>
+        <td>Rollenbreite / Roll Width</td>
+        <td>1220 mm</td>
+        <td/>
+        <td>Geprueft nach / approved according to</td>
+        <td>ISO 3310</td>
+      </tr>
+    </blockTable>
+
+    <nextFrame/>
+
+    <blockTable style="measuresummary" colWidths="73mm, 15mm">
+      <tr><td>Messergebnisse / Results:</td><td/></tr>
+      <tr><td>Durchschnittliche Dicke [um]</td><td>61.8</td></tr>
+      <tr><td>Average Thickness[mils]</td><td>2.41</td></tr>
+      <tr><td>Std. Abweichung [um]</td><td>0.95</td></tr>
+      <tr><td>Std. Deviation [mils]</td><td>0.037</td></tr>
+      <tr><td>Max. Dicke [um]</td><td>63.0</td></tr>
+      <tr><td>Max. Thickness [mils]</td><td>2.46</td></tr>
+      <tr><td>Min. Dicke [um]</td><td>60.0</td></tr>
+      <tr><td>Min. Thickness [mils]</td><td>2.34</td></tr>
+      <tr><td></td><td></td></tr>
+      <tr><td>1 [um] = 0.039 [mils]</td><td></td></tr>
+      <tr><td></td><td></td></tr>
+      <tr><td>Haeufigkeitsverteilung / Histogramm</td><td></td></tr>
+    </blockTable>
+    <illustration width="81.13mm" height="56.44mm">
+      <chart dheight="56.44mm" dangle="0" height="160" width="230" dx="14.0mm" 
+            x="0" y="0" charttype="VerticalBarChart" dy="-4.1mm" dwidth="81.13mm">
+        <data dataset="[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 9.0, 31.0, 30.0, 30.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]]" />
+        <texts>
+          <text textAnchor="start" fontName="Helvetica" angle="-90" y="-1.45cm" 
+                x="-2.95cm" desc="[%]" 
+                textColor="black" size="10"/>
+          <text textAnchor="start" fontName="Helvetica" angle="0" y="-1.3cm" 
+                x="1.0cm" desc="Gewebe Dicke / Mesh Thickness [um]" textColor="black" size="10"/>
+        </texts>
+        <bars strokeWidth="0.5">
+          <bar fillColor="red"/>
+          <bar fillColor="blue"/>
+        </bars>
+        <valueAxis tickLeft="0" strokeColor="black" strokeWidth="1" visibleGrid="1" 
+            gridStrokeColor="black"><labels fontName="Helvetica"/>
+        </valueAxis>
+        <categoryAxis strokeColor="black" strokeWidth="1" 
+            categoryNames="['53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71']">
+          <labels fontName="Helvetica" angle="90" dx="-5" dy="-12"/>
+        </categoryAxis>
+      </chart>
+    </illustration>
+    <blockTable style="measuresummary2" colWidths="73mm, 15mm">
+      <tr><td>Bemerkungen / Remarks:</td><td/></tr>
+    </blockTable>
+    <nextFrame/>    
+    <blockTable style="measuredetails" colWidths="12mm, 11mm, 14mm, 14mm">
+      <tr><td>Messungen / Measurements [Microns]</td><td/><td/><td/></tr>
+      <tr><td>Point</td><td>L </td><td>M </td><td>R </td></tr>
+      <tr><td>1</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>2</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>3</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>4</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>5</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>6</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>7</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>8</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>9</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>10</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>11</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>12</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>13</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>14</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>15</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>16</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>17</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>18</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>19</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>20</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>21</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>22</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>23</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>24</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>25</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>26</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>27</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>28</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>29</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>30</td><td>62</td><td>62</td><td>62</td></tr>
+      <tr><td>31</td><td>62</td><td>62</td><td>62</td></tr>
+    </blockTable>
+    <nextFrame/>
+    <blockTable style="footer" colWidths="55mm, 34mm, 15mm, 40.5mm, 38mm">
+      <tr>
+        <td>Datum / Date: 05.01.2005</td>
+        <td/>
+        <td/>
+        <td>Pruefer / Inspector: Colner Davor</td>
+        <td>
+          <illustration width="25mm" height="9.5mm">
+            <fsimage y="-4mm" width="25mm" x="0mm" file="../sample/dcolner.gif" height="9.5mm"/>
+          </illustration>
+        </td>
+      </tr>
+    </blockTable>
+  </story>
+</document>
\ No newline at end of file


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/thicknessprot.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/tiny_logo.png
===================================================================
(Binary files differ)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample/tiny_logo.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample.zcml
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample.zcml	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample.zcml	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,195 @@
+<configure
+    xmlns:browser="http://namespaces.zope.org/browser"
+    xmlns:zcml="http://namespaces.zope.org/zcml"
+    zcml:condition="have devmode"
+    i18n_domain="zope">
+
+  <!-- examples for reStructed Text to PDF conversion -->
+
+  <browser:rest2pdf
+      name="sample_rest.pdf"
+      path="sample/rest.txt"
+      />
+
+  <browser:rest2pdf
+      name="sample_rest2.pdf"
+      path="sample/rest.txt"
+      template="sample/rest_template.pt"
+      />
+
+
+  <!-- examples for PML to PDF conversion -->
+
+  <browser:pml2pdf
+      name="sample_pml.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      template="sample/pml_template.pt"
+      document="sample/pml_contents.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+
+  <!-- examples for tinyRML to PDF conversion -->
+
+  <browser:rml2pdf
+      name="sample_rml.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/rml_contents.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex01.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex01.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex02.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex02.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex03.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex03.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex04.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex04.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex05.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex05.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex06.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex06.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex07.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex07.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex08.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex07.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex09.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex09.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex10.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex10.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex11.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex11.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex12.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex12.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex13.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex13.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="ex14.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/ex14.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="rollcard.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/rollcard.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="micromeshfoto.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/micromeshfoto.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="micromeshprot.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/micromeshprot.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="raylprot.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/raylprot.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+  <browser:rml2pdf
+      name="thicknessprot.pdf"
+      for="zope.app.folder.interfaces.IFolder"
+      document="sample/thicknessprot.pt"
+      class="zope.app.container.browser.contents.Contents"
+      permission="zope.Public"
+      />
+
+</configure>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/sample.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/tests.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/tests.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/tests.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+###############################################################################
+"""Tests for the Book Documentation Module
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+import unittest
+import zope.component
+
+from zope.testing import doctest, doctestunit
+from zope.app import principalannotation
+from zope.copypastemove import PrincipalClipboard
+from zope.app.testing import placelesssetup, setup, ztapi
+
+
+def setUp(test):
+    placelesssetup.setUp(test)
+    setup.setUpTraversal()
+
+    zope.component.provideUtility(
+        principalannotation.PrincipalAnnotationUtility(),
+        principalannotation.IPrincipalAnnotationUtility)
+    zope.component.provideAdapter(
+        principalannotation.annotations,
+        adapts=(None,))
+    zope.component.provideAdapter(
+        PrincipalClipboard)
+
+def test_suite():
+    return unittest.TestSuite((
+        doctest.DocFileSuite('README.txt',
+            setUp=setUp, tearDown=placelesssetup.tearDown,
+            optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
+        ))
+
+
+if __name__ == '__main__':
+    unittest.main(default='test_suite')


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/tests.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/COPYRIGHT.txt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/COPYRIGHT.txt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/COPYRIGHT.txt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,3 @@
+This code is copyrighted by Fabien Pinckaers (http://tiny.be)
+
+This is released under L-GPL License (see LICENSE.TXT).


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/COPYRIGHT.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/INSTALL.txt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/INSTALL.txt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/INSTALL.txt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,11 @@
+Installing Tiny RML2PDF
+
+Dependencies:
+	- Reportlab PDF-Toolkit current version
+	- Python-Imaging (PIL) if you use bitmap pictures
+
+To install Tiny RML2PDF, copy the directory trml2pdf where you want!
+
+That's all folks :)
+
+This Software is only tested with Linux and Python-2.2


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/INSTALL.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/LICENSE.txt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/LICENSE.txt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/LICENSE.txt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,504 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/LICENSE.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/README.txt
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/README.txt	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/README.txt	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,54 @@
+Name
+----
+
+trml2pdf - convert a Report Markup Langage (RML) file to a PDF
+
+
+Synopsis
+--------
+
+	trml2pdf --help
+	trml2pdf <input.rml >ouput.pdf
+
+Description
+-----------
+
+Tiny RML2PDF is a tool to easily create PDF document without programming. It
+can be used as a Python library or as a standalone binary. It converts a RML,
+an XML dialect that lets you define the precise appearance of a printed
+document, to a PDF. You can use your existing tools to generate an input file
+that exactly describes the layout of a printed document, and RML2PDF converts
+it into PDF. RML is a much more powerfull and flexible alternative to XSL:FO.
+
+The executable read a RML file to the standard input and output a PDF file to
+the standard output.
+
+
+Command-line options
+--------------------
+
+	--help: command line options
+
+Examples
+--------
+
+Create a PDF file:
+
+	trml2pdf <input.rml
+
+Use it as a python module:
+
+	import trml2pdf
+	print trml2pdf.parseString(file('file.rml','r').read())
+
+Notes
+-----
+
+Tiny RML2PDF is a component of the Open Report project. It can be used with the
+Tiny Reporting Server to have a complete solution to render PDF file on the
+fly.
+
+Author
+------
+
+Fabien Pinckaers (http://tiny.be)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/__init__.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/__init__.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/__init__.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,18 @@
+# trml2pdf - An RML to PDF converter
+# Copyright (C) 2003, Fabien Pinckaers, UCL, FSA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+from trml2pdf import parseString


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/color.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/color.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/color.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,36 @@
+# trml2pdf - An RML to PDF converter
+# Copyright (C) 2003, Fabien Pinckaers, UCL, FSA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+from reportlab.lib import colors
+import re
+
+allcols = colors.getAllNamedColors()
+
+regex_t = re.compile('\(([0-9\.]*),([0-9\.]*),([0-9\.]*)\)')
+regex_h = re.compile('#([0-9a-zA-Z][0-9a-zA-Z])([0-9a-zA-Z][0-9a-zA-Z])([0-9a-zA-Z][0-9a-zA-Z])')
+
+def get(col_str):
+	global allcols
+	if col_str in allcols.keys():
+		return allcols[col_str]
+	res = regex_t.search(col_str, 0)
+	if res:
+		return (float(res.group(1)),float(res.group(2)),float(res.group(3)))
+	res = regex_h.search(col_str, 0)
+	if res:
+		return tuple([ float(int(res.group(i),16))/255 for i in range(1,4)])
+	return colors.red


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/color.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trml2pdf.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trml2pdf.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trml2pdf.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,560 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+###############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+###############################################################################
+
+import sys
+import StringIO
+import xml.dom.minidom
+import copy
+
+import reportlab
+from reportlab.pdfgen import canvas
+from reportlab import platypus
+
+import utils
+import color
+
+from z3c.pdftemplate.trml2pdf import trmlextchart
+from z3c.pdftemplate.trml2pdf import trmlextfsimage
+
+#
+# Change this to UTF-8 if you plan tu use Reportlab's UTF-8 support
+#
+encoding = 'UTF-8'
+
+def _child_get(node, childs):
+	clds = []
+	for n in node.childNodes:
+		if (n.nodeType==n.ELEMENT_NODE) and (n.localName==childs):
+			clds.append(n)
+	return clds
+
+class _rml_styles(object):
+	def __init__(self, nodes):
+		self.styles = {}
+		self.names = {}
+		self.table_styles = {}
+		for node in nodes:
+			for style in node.getElementsByTagName('blockTableStyle'):
+				self.table_styles[style.getAttribute('id')] = self._table_style_get(style)
+			for style in node.getElementsByTagName('paraStyle'):
+				self.styles[style.getAttribute('name')] = self._para_style_get(style)
+			for variable in node.getElementsByTagName('initialize'):
+				for name in variable.getElementsByTagName('name'):
+					self.names[ name.getAttribute('id')] = name.getAttribute('value')
+
+	def _para_style_update(self, style, node):
+		for attr in ['textColor', 'backColor', 'bulletColor']:
+			if node.hasAttribute(attr):
+				style.__dict__[attr] = color.get(node.getAttribute(attr))
+		for attr in ['fontName', 'bulletFontName', 'bulletText']:
+			if node.hasAttribute(attr):
+				style.__dict__[attr] = node.getAttribute(attr)
+		for attr in ['fontSize', 'leftIndent', 'rightIndent', 'spaceBefore', 'spaceAfter', 'firstLineIndent', 'bulletIndent', 'bulletFontSize', 'leading']:
+			if node.hasAttribute(attr):
+				style.__dict__[attr] = utils.unit_get(node.getAttribute(attr))
+		if node.hasAttribute('alignment'):
+			align = {
+				'right':reportlab.lib.enums.TA_RIGHT,
+				'center':reportlab.lib.enums.TA_CENTER,
+				'justify':reportlab.lib.enums.TA_JUSTIFY
+			}
+			style.alignment = align.get(node.getAttribute('alignment').lower(), reportlab.lib.enums.TA_LEFT)
+		return style
+
+	def _table_style_get(self, style_node):
+		styles = []
+		for node in style_node.childNodes:
+			if node.nodeType==node.ELEMENT_NODE:
+				start = utils.tuple_int_get(node, 'start', (0,0) )
+				stop = utils.tuple_int_get(node, 'stop', (-1,-1) )
+				if node.localName=='blockValign':
+					styles.append(('VALIGN', start, stop, str(node.getAttribute('value'))))
+				elif node.localName=='blockFont':
+					styles.append(('FONT', start, stop, str(node.getAttribute('name'))))
+				elif node.localName=='blockTextColor':
+					styles.append(('TEXTCOLOR', start, stop, color.get(str(node.getAttribute('colorName')))))
+				elif node.localName=='blockLeading':
+					styles.append(('LEADING', start, stop, utils.unit_get(node.getAttribute('length'))))
+				elif node.localName=='blockAlignment':
+					styles.append(('ALIGNMENT', start, stop, str(node.getAttribute('value'))))
+				elif node.localName=='blockLeftPadding':
+					styles.append(('LEFTPADDING', start, stop, utils.unit_get(node.getAttribute('length'))))
+				elif node.localName=='blockRightPadding':
+					styles.append(('RIGHTPADDING', start, stop, utils.unit_get(node.getAttribute('length'))))
+				elif node.localName=='blockTopPadding':
+					styles.append(('TOPPADDING', start, stop, utils.unit_get(node.getAttribute('length'))))
+				elif node.localName=='blockBottomPadding':
+					styles.append(('BOTTOMPADDING', start, stop, utils.unit_get(node.getAttribute('length'))))
+				elif node.localName=='blockBackground':
+					styles.append(('BACKGROUND', start, stop, color.get(node.getAttribute('colorName'))))
+				if node.hasAttribute('size'):
+					styles.append(('FONTSIZE', start, stop, utils.unit_get(node.getAttribute('size'))))
+				elif node.localName=='lineStyle':
+					kind = node.getAttribute('kind')
+					kind_list = [ 'GRID', 'BOX', 'OUTLINE', 'INNERGRID', 'LINEBELOW', 'LINEABOVE','LINEBEFORE', 'LINEAFTER' ]
+					assert kind in kind_list
+					thick = 1
+					if node.hasAttribute('thickness'):
+						thick = float(node.getAttribute('thickness'))
+					styles.append((kind, start, stop, thick,  color.get(node.getAttribute('colorName'))))
+		return platypus.tables.TableStyle(styles)
+
+	def _para_style_get(self, node):
+		styles = reportlab.lib.styles.getSampleStyleSheet()
+		style = copy.deepcopy(styles["Normal"])
+		self._para_style_update(style, node)
+		return style
+
+	def para_style_get(self, node):
+		style = False
+		if node.hasAttribute('style'):
+			if node.getAttribute('style') in self.styles:
+				style = copy.deepcopy(self.styles[node.getAttribute('style')])
+			else:
+				sys.stderr.write('Warning: style not found, %s - setting default!\n' % (node.getAttribute('style'),) )
+		if not style:
+			styles = reportlab.lib.styles.getSampleStyleSheet()
+			style = copy.deepcopy(styles['Normal'])
+		return self._para_style_update(style, node)
+
+class _rml_doc(object):
+	def __init__(self, data):
+		self.dom = xml.dom.minidom.parseString(data)
+		self.filename = self.dom.documentElement.getAttribute('filename')
+
+	def docinit(self, els):
+		from reportlab.lib.fonts import addMapping
+		from reportlab.pdfbase import pdfmetrics
+		from reportlab.pdfbase.ttfonts import TTFont
+
+		for node in els:
+			for font in node.getElementsByTagName('registerFont'):
+				name = font.getAttribute('fontName').encode('ascii')
+				fname = font.getAttribute('fontFile').encode('ascii')
+				pdfmetrics.registerFont(TTFont(name, fname ))
+				addMapping(name, 0, 0, name)    #normal
+				addMapping(name, 0, 1, name)    #italic
+				addMapping(name, 1, 0, name)    #bold
+				addMapping(name, 1, 1, name)    #italic and bold
+
+	def render(self, out):
+		el = self.dom.documentElement.getElementsByTagName('docinit')
+		if el:
+			self.docinit(el)
+
+		el = self.dom.documentElement.getElementsByTagName('stylesheet')
+		self.styles = _rml_styles(el)
+
+		el = self.dom.documentElement.getElementsByTagName('template')
+		if len(el):
+			pt_obj = _rml_template(out, el[0], self)
+			pt_obj.render(self.dom.documentElement.getElementsByTagName('story')[0])
+		else:
+			self.canvas = canvas.Canvas(out)
+			pd = self.dom.documentElement.getElementsByTagName('pageDrawing')[0]
+			pd_obj = _rml_canvas(self.canvas, None, self)
+			pd_obj.render(pd)
+			self.canvas.showPage()
+			self.canvas.save()
+
+class _rml_canvas(object):
+	def __init__(self, canvas, doc_tmpl=None, doc=None):
+		self.canvas = canvas
+		self.styles = doc.styles
+		self.doc_tmpl = doc_tmpl
+		self.doc = doc
+
+	def _textual(self, node):
+		rc = ''
+		for n in node.childNodes:
+			if n.nodeType == n.ELEMENT_NODE:
+				if n.localName=='pageNumber':
+					rc += str(self.canvas.getPageNumber())
+			elif (n.nodeType == node.CDATA_SECTION_NODE):
+				rc += n.data
+			elif (n.nodeType == node.TEXT_NODE):
+				rc += n.data
+		return rc.encode(encoding)
+
+	def _drawString(self, node):
+		self.canvas.drawString(text=self._textual(node), **utils.attr_get(node, ['x','y']))
+	def _drawCenteredString(self, node):
+		self.canvas.drawCentredString(text=self._textual(node), **utils.attr_get(node, ['x','y']))
+	def _drawRightString(self, node):
+		self.canvas.drawRightString(text=self._textual(node), **utils.attr_get(node, ['x','y']))
+	def _rect(self, node):
+		if node.hasAttribute('round'):
+			self.canvas.roundRect(radius=utils.unit_get(node.getAttribute('round')), **utils.attr_get(node, ['x','y','width','height'], {'fill':'bool','stroke':'bool'}))
+		else:
+			self.canvas.rect(**utils.attr_get(node, ['x','y','width','height'], {'fill':'bool','stroke':'bool'}))
+	def _ellipse(self, node):
+		x1 = utils.unit_get(node.getAttribute('x'))
+		x2 = utils.unit_get(node.getAttribute('width'))
+		y1 = utils.unit_get(node.getAttribute('y'))
+		y2 = utils.unit_get(node.getAttribute('height'))
+		self.canvas.ellipse(x1,y1,x2,y2, **utils.attr_get(node, [], {'fill':'bool','stroke':'bool'}))
+	def _curves(self, node):
+		line_str = utils.text_get(node).split()
+		lines = []
+		while len(line_str)>7:
+			self.canvas.bezier(*[utils.unit_get(l) for l in line_str[0:8]])
+			line_str = line_str[8:]
+	def _lines(self, node):
+		line_str = utils.text_get(node).split()
+		lines = []
+		while len(line_str)>3:
+			lines.append([utils.unit_get(l) for l in line_str[0:4]])
+			line_str = line_str[4:]
+		self.canvas.lines(lines)
+	def _grid(self, node):
+		xlist = [utils.unit_get(s) for s in node.getAttribute('xs').split(',')]
+		ylist = [utils.unit_get(s) for s in node.getAttribute('ys').split(',')]
+		self.canvas.grid(xlist, ylist)
+	def _translate(self, node):
+		dx = 0
+		dy = 0
+		if node.hasAttribute('dx'):
+			dx = utils.unit_get(node.getAttribute('dx'))
+		if node.hasAttribute('dy'):
+			dy = utils.unit_get(node.getAttribute('dy'))
+		self.canvas.translate(dx,dy)
+
+	def _circle(self, node):
+		self.canvas.circle(x_cen=utils.unit_get(node.getAttribute('x')), y_cen=utils.unit_get(node.getAttribute('y')), r=utils.unit_get(node.getAttribute('radius')), **utils.attr_get(node, [], {'fill':'bool','stroke':'bool'}))
+
+	def _place(self, node):
+		flows = _rml_flowable(self.doc).render(node)
+		infos = utils.attr_get(node, ['x','y','width','height'])
+
+		infos['y']+=infos['height']
+		for flow in flows:
+			w,h = flow.wrap(infos['width'], infos['height'])
+			if w<=infos['width'] and h<=infos['height']:
+				infos['y']-=h
+				flow.drawOn(self.canvas,infos['x'],infos['y'])
+				infos['height']-=h
+			else:
+				raise ValueError, "Not enough space"
+
+	def _line_mode(self, node):
+		ljoin = {'round':1, 'mitered':0, 'bevelled':2}
+		lcap = {'default':0, 'round':1, 'square':2}
+		if node.hasAttribute('width'):
+			self.canvas.setLineWidth(utils.unit_get(node.getAttribute('width')))
+		if node.hasAttribute('join'):
+			self.canvas.setLineJoin(ljoin[node.getAttribute('join')])
+		if node.hasAttribute('cap'):
+			self.canvas.setLineCap(lcap[node.getAttribute('cap')])
+		if node.hasAttribute('miterLimit'):
+			self.canvas.setDash(utils.unit_get(node.getAttribute('miterLimit')))
+		if node.hasAttribute('dash'):
+			dashes = node.getAttribute('dash').split(',')
+			for x in range(len(dashes)):
+				dashes[x]=utils.unit_get(dashes[x])
+			self.canvas.setDash(node.getAttribute('dash').split(','))
+
+	def _image(self, node):
+		import urllib
+		from reportlab.lib.utils import ImageReader
+		u = urllib.urlopen(str(node.getAttribute('file')))
+		s = StringIO.StringIO()
+		s.write(u.read())
+		s.seek(0)
+		img = ImageReader(s)
+		(sx,sy) = img.getSize()
+
+		args = {}
+		for tag in ('width','height','x','y'):
+			if node.hasAttribute(tag):
+				args[tag] = utils.unit_get(node.getAttribute(tag))
+		if ('width' in args) and (not 'height' in args):
+			args['height'] = sy * args['width'] / sx
+		elif ('height' in args) and (not 'width' in args):
+			args['width'] = sx * args['height'] / sy
+		elif ('width' in args) and ('height' in args):
+			if (float(args['width'])/args['height'])>(float(sx)>sy):
+				args['width'] = sx * args['height'] / sy
+			else:
+				args['height'] = sy * args['width'] / sx
+		self.canvas.drawImage(img, **args)
+
+	def _chart(self, node):
+		trmlextchart.Chart(self, node)
+
+	def _fsimage(self, node):
+		trmlextfsimage.fsimage(self, node)
+
+	def _path(self, node):
+		self.path = self.canvas.beginPath()
+		self.path.moveTo(**utils.attr_get(node, ['x','y']))
+		for n in node.childNodes:
+			if n.nodeType == node.ELEMENT_NODE:
+				if n.localName=='moveto':
+					vals = utils.text_get(n).split()
+					self.path.moveTo(utils.unit_get(vals[0]), utils.unit_get(vals[1]))
+				elif n.localName=='curvesto':
+					vals = utils.text_get(n).split()
+					while len(vals)>5:
+						pos=[]
+						while len(pos)<6:
+							pos.append(utils.unit_get(vals.pop(0)))
+						self.path.curveTo(*pos)
+			elif (n.nodeType == node.TEXT_NODE):
+				data = n.data.split()               # Not sure if I must merge all TEXT_NODE ?
+				while len(data)>1:
+					x = utils.unit_get(data.pop(0))
+					y = utils.unit_get(data.pop(0))
+					self.path.lineTo(x,y)
+		if (not node.hasAttribute('close')) or utils.bool_get(node.getAttribute('close')):
+			self.path.close()
+		self.canvas.drawPath(self.path, **utils.attr_get(node, [], {'fill':'bool','stroke':'bool'}))
+
+	def render(self, node):
+		tags = {
+			'drawCentredString': self._drawCenteredString,
+			'drawRightString': self._drawRightString,
+			'drawString': self._drawString,
+			'rect': self._rect,
+			'ellipse': self._ellipse,
+			'lines': self._lines,
+			'grid': self._grid,
+			'curves': self._curves,
+			'fill': lambda node: self.canvas.setFillColor(color.get(node.getAttribute('color'))),
+			'stroke': lambda node: self.canvas.setStrokeColor(color.get(node.getAttribute('color'))),
+			'setFont': lambda node: self.canvas.setFont(node.getAttribute('name'), utils.unit_get(node.getAttribute('size'))),
+			'place': self._place,
+			'circle': self._circle,
+			'lineMode': self._line_mode,
+			'path': self._path,
+			'rotate': lambda node: self.canvas.rotate(float(node.getAttribute('degrees'))),
+			'translate': self._translate,
+			'image': self._image,
+            'fsimage': self._fsimage,
+            'chart': self._chart
+		}
+		for nd in node.childNodes:
+			if nd.nodeType==nd.ELEMENT_NODE:
+				for tag in tags:
+					if nd.localName==tag:
+						tags[tag](nd)
+						break
+
+class _rml_draw(object):
+	def __init__(self, node, styles):
+		self.node = node
+		self.styles = styles
+		self.canvas = None
+
+	def render(self, canvas, doc):
+		canvas.saveState()
+		cnv = _rml_canvas(canvas, doc, self.styles)
+		cnv.render(self.node)
+		canvas.restoreState()
+
+class _rml_flowable(object):
+	def __init__(self, doc):
+		self.doc = doc
+		self.styles = doc.styles
+
+	def _textual(self, node):
+		rc = ''
+		for n in node.childNodes:
+			if n.nodeType == node.ELEMENT_NODE:
+				if n.localName=='getName':
+					newNode = self.doc.dom.createTextNode(self.styles.names.get(n.getAttribute('id'),'Unknown name'))
+					node.insertBefore(newNode, n)
+					node.removeChild(n)
+				if n.localName=='pageNumber':
+					rc+='<pageNumber/>'            # TODO: change this !
+				else:
+					self._textual(n)
+				rc += n.toxml()
+			elif (n.nodeType == node.CDATA_SECTION_NODE):
+				rc += n.data
+			elif (n.nodeType == node.TEXT_NODE):
+				rc += n.data
+		return rc.encode(encoding)
+
+	def _table(self, node):
+		length = 0
+		colwidths = None
+		rowheights = None
+		data = []
+		for tr in _child_get(node,'tr'):
+			data2 = []
+			for td in _child_get(tr, 'td'):
+				flow = []
+				for n in td.childNodes:
+					if n.nodeType==node.ELEMENT_NODE:
+						flow.append( self._flowable(n) )
+				if not len(flow):
+					flow = self._textual(td)
+				data2.append( flow )
+			if len(data2)>length:
+				length=len(data2)
+				for ab in data:
+					while len(ab)<length:
+						ab.append('')
+			while len(data2)<length:
+				data2.append('')
+			data.append( data2 )
+		if node.hasAttribute('colWidths'):
+			assert length == len(node.getAttribute('colWidths').split(','))
+			colwidths = [utils.unit_get(f.strip()) for f in node.getAttribute('colWidths').split(',')]
+		if node.hasAttribute('rowHeights'):
+			rowheights = [utils.unit_get(f.strip()) for f in node.getAttribute('rowHeights').split(',')]
+		table = platypus.Table(data = data, colWidths=colwidths, rowHeights=rowheights, **(utils.attr_get(node, ['splitByRow'] ,{'repeatRows':'int','repeatCols':'int'})))
+		if node.hasAttribute('style'):
+			table.setStyle(self.styles.table_styles[node.getAttribute('style')])
+		return table
+
+	def _illustration(self, node):
+		class Illustration(platypus.flowables.Flowable):
+			def __init__(self, node, styles):
+				self.node = node
+				self.styles = styles
+				self.width = utils.unit_get(node.getAttribute('width'))
+				self.height = utils.unit_get(node.getAttribute('height'))
+			def wrap(self, *args):
+				return (self.width, self.height)
+			def draw(self):
+				canvas = self.canv
+				drw = _rml_draw(self.node, self.styles)
+				drw.render(self.canv, None)
+		return Illustration(node, self.styles)
+
+	def _flowable(self, node):
+		if node.localName=='para':
+			style = self.styles.para_style_get(node)
+			return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'})))
+		elif node.localName=='name':
+			self.styles.names[ node.getAttribute('id')] = node.getAttribute('value')
+			return None
+		elif node.localName=='xpre':
+			style = self.styles.para_style_get(node)
+			return platypus.XPreformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int','frags':'int'})))
+		elif node.localName=='pre':
+			style = self.styles.para_style_get(node)
+			return platypus.Preformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int'})))
+		elif node.localName=='illustration':
+			return  self._illustration(node)
+		elif node.localName=='blockTable':
+			return  self._table(node)
+		elif node.localName=='title':
+			styles = reportlab.lib.styles.getSampleStyleSheet()
+			style = styles['Title']
+			return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'})))
+		elif node.localName=='h1':
+			styles = reportlab.lib.styles.getSampleStyleSheet()
+			style = styles['Heading1']
+			return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'})))
+		elif node.localName=='h2':
+			styles = reportlab.lib.styles.getSampleStyleSheet()
+			style = styles['Heading2']
+			return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'})))
+		elif node.localName=='h3':
+			styles = reportlab.lib.styles.getSampleStyleSheet()
+			style = styles['Heading3']
+			return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'})))
+		elif node.localName=='image':
+			return platypus.Image(node.getAttribute('file'), mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height'])))
+		elif node.localName=='spacer':
+			if node.hasAttribute('width'):
+				width = utils.unit_get(node.getAttribute('width'))
+			else:
+				width = utils.unit_get('1cm')
+			length = utils.unit_get(node.getAttribute('length'))
+			return platypus.Spacer(width=width, height=length)
+		elif node.localName=='pageBreak':
+			return platypus.PageBreak()
+		elif node.localName=='condPageBreak':
+			return platypus.CondPageBreak(**(utils.attr_get(node, ['height'])))
+		elif node.localName=='setNextTemplate':
+			return platypus.NextPageTemplate(str(node.getAttribute('name')))
+		elif node.localName=='nextFrame':
+			return platypus.CondPageBreak(1000)           # TODO: change the 1000 !
+		else:
+			sys.stderr.write('Warning: flowable not yet implemented: %s !\n' % (node.localName,))
+			return None
+
+	def render(self, node_story):
+		story = []
+		node = node_story.firstChild
+		while node:
+			if node.nodeType == node.ELEMENT_NODE:
+				flow = self._flowable(node)
+				if flow:
+					story.append(flow)
+			node = node.nextSibling
+		return story
+
+class _rml_template(object):
+	def __init__(self, out, node, doc):
+		if not node.hasAttribute('pageSize'):
+			pageSize = (utils.unit_get('21cm'), utils.unit_get('29.7cm'))
+		else:
+			ps = map(lambda x:x.strip(), node.getAttribute('pageSize').replace(')', '').replace('(', '').split(','))
+			pageSize = ( utils.unit_get(ps[0]),utils.unit_get(ps[1]) )
+		cm = reportlab.lib.units.cm
+		self.doc_tmpl = platypus.BaseDocTemplate(out, pagesize=pageSize, **utils.attr_get(node, ['leftMargin','rightMargin','topMargin','bottomMargin'], {'allowSplitting':'int','showBoundary':'bool','title':'str','author':'str'}))
+		self.page_templates = []
+		self.styles = doc.styles
+		self.doc = doc
+		pts = node.getElementsByTagName('pageTemplate')
+		for pt in pts:
+			frames = []
+			for frame_el in pt.getElementsByTagName('frame'):
+				frame = platypus.Frame( **(utils.attr_get(frame_el, ['x1','y1', 'width','height', 'leftPadding', 'rightPadding', 'bottomPadding', 'topPadding'], {'id':'text', 'showBoundary':'bool'})) )
+				frames.append( frame )
+			gr = pt.getElementsByTagName('pageGraphics')
+			if len(gr):
+				drw = _rml_draw(gr[0], self.doc)
+				self.page_templates.append( platypus.PageTemplate(frames=frames, onPage=drw.render, **utils.attr_get(pt, [], {'id':'str'}) ))
+			else:
+				self.page_templates.append( platypus.PageTemplate(frames=frames, **utils.attr_get(pt, [], {'id':'str'}) ))
+		self.doc_tmpl.addPageTemplates(self.page_templates)
+
+	def render(self, node_story):
+		r = _rml_flowable(self.doc)
+		fis = r.render(node_story)
+		self.doc_tmpl.build(fis)
+
+def parseString(data, fout=None):
+	r = _rml_doc(data)
+	if fout:
+		fp = file(fout,'wb')
+		r.render(fp)
+		fp.close()
+		return fout
+	else:
+		fp = StringIO.StringIO()
+		r.render(fp)
+		return fp.getvalue()
+
+def trml2pdf_help():
+	print 'Usage: trml2pdf input.rml >output.pdf'
+	print 'Render the standard input (RML) and output a PDF file'
+	sys.exit(0)
+
+if __name__=="__main__":
+	if len(sys.argv)>1:
+		if sys.argv[1]=='--help':
+			trml2pdf_help()
+		print parseString(file(sys.argv[1], 'r').read()),
+	else:
+		print 'Usage: trml2pdf input.rml >output.pdf'
+		print 'Try \'trml2pdf --help\' for more information.'


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trml2pdf.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trmlextchart.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trmlextchart.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trmlextchart.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,645 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+###############################################################################
+"""Package z3c.pdftemplate.trml2pdf.
+
+$Id: trmlextchart.py 2701 2005-07-04 14:25:54Z daniel.meier$
+"""
+
+import utils
+
+
+from reportlab.graphics.charts.barcharts import HorizontalBarChart
+from reportlab.graphics.charts.barcharts import HorizontalBarChart3D
+from reportlab.graphics.charts.barcharts import VerticalBarChart
+from reportlab.graphics.charts.barcharts import VerticalBarChart3D
+from reportlab.graphics.charts.lineplots import LinePlot
+from reportlab.graphics.charts.piecharts import Pie
+from reportlab.graphics.charts.spider    import SpiderChart
+from reportlab.graphics.charts.doughnut  import Doughnut
+from reportlab.graphics.charts.slidebox  import SlideBox
+
+from reportlab.graphics.shapes import Drawing
+from reportlab.graphics.shapes import Group
+from reportlab.graphics.shapes import String
+
+from reportlab.graphics.widgets.markers import makeMarker
+
+from reportlab.lib import colors
+
+
+
+class Chart(object):
+
+    def __init__(self, renderObj, node):
+        tags = {
+            'LinePlot': LinePlot,
+            'Pie': Pie,
+            'HorizontalBarChart': HorizontalBarChart,
+            'VerticalBarChart': VerticalBarChart,
+            'HorizontalBarChart3D': HorizontalBarChart3D,
+            'VerticalBarChart3D': VerticalBarChart3D,
+            'SpiderChart': SpiderChart,
+            'Doughnut': Doughnut,
+            'SlideBox': SlideBox,
+            }
+
+
+        for k, v in tags.items():
+            if k==node.getAttribute('charttype').encode('ascii'):
+                self.chart = v()
+
+        tags = {
+            'LinePlot': self._linePlot,
+            'Pie': self._pie,
+            'HorizontalBarChart': self._horizontalBarChart,
+            'VerticalBarChart': self._verticalBarChart,
+            'HorizontalBarChart3D': self._horizontalBarChart3D,
+            'VerticalBarChart3D': self._verticalBarChart3D,
+            'SpiderChart': self._spiderChart,
+            'Doughnut': self._doughnut,
+            'SlideBox': self._slideBox,
+            }
+
+        if node.hasAttribute('charttype'):
+            chart = tags[node.getAttribute('charttype').encode('ascii')](node);
+            args = {}
+            for tag in ('dwidth','dheight','dx','dy', 'dangle', ):
+                if node.hasAttribute(tag):
+                    args[tag] = utils.unit_get(node.getAttribute(tag))
+
+            d = Drawing(args['dwidth'], args['dheight'])
+            g = Group(chart)
+            g.translate(0,0)
+            g.rotate(utils.unit_get(node.getAttribute('dangle')))
+            d.add(g)
+
+            for subnode in node.getElementsByTagName('texts'):
+                for tnode in subnode.getElementsByTagName('text'):
+                    tstring = String(utils.unit_get(tnode.getAttribute('x')), utils.unit_get(tnode.getAttribute('y')), tnode.getAttribute('desc').encode('ascii'))
+                    for tag in ('fontSize', ):
+                        if tnode.hasAttribute(tag):
+                            attrvalue = utils.unit_get(tnode.getAttribute(tag))
+                            setattr(tstring, tag, attrvalue)
+
+                    for tag in ('fillColor', ):
+                        if tnode.hasAttribute(tag):
+                            attrvalue = eval('colors.' + tnode.getAttribute(tag).encode('ascii'))
+                            setattr(tstring, tag, attrvalue)
+
+                    for tag in ('fontName', 'textAnchor'):
+                        if tnode.hasAttribute(tag):
+                            attrvalue = tnode.getAttribute(tag).encode('ascii')
+                            setattr(tstring, tag, attrvalue)
+                    g = Group(tstring)
+                    g.translate(0,0)
+                    g.rotate(utils.unit_get(tnode.getAttribute('angle')))
+                    d.add(g)
+                    #print tnode.getAttribute('desc').encode('ascii')
+
+            d.drawOn(renderObj.canvas, args['dx'], args['dy'], _sW=0)
+
+    def _background(self, ref, node):
+        #TODO
+        #isNoneOrShape
+        pass
+
+
+    def _label(self, ref, node):
+        for tag in ('x', 'y', 'dx','dy','angle','boxStrokeWidth', 'strokeWidth', 'fontSize', 'leading', 'width', 'maxWidth', \
+                    'height', 'topPadding', 'leftPadding', 'rightPadding', 'bottomPadding'):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('visible', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.bool_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('fontName', 'boxAnchor', 'textAnchor'):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii')
+                setattr(ref, tag, attrvalue)
+
+        for tag in ('boxStrokeColor', 'boxFillColor', 'fillColor', 'strokeColor'):
+            if node.hasAttribute(tag):
+                attrvalue = eval('colors.' + node.getAttribute(tag).encode('ascii'))
+                setattr(ref, tag, attrvalue)
+
+        for tag in ('text', ):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii')
+                setattr(ref, '_'+tag, attrvalue)
+                #TODO
+                #setText
+
+
+    def _labels(self, ref, node):
+        self._label(ref,node)
+        tags = {
+             'label': self._label,
+            }
+        i=0
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(ref[i], subnode)
+                i=i+1
+
+
+    def _lineLabels(self, ref, node):
+        self._label(ref,node)
+        tags = {
+             'lineLabel': self._label,
+            }
+        i=0
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(ref[i], subnode)
+                i=i+1
+
+
+    def _barLabels(self, ref, node):
+        self._label(ref,node)
+        tags = {
+             'barLabel': self._label,
+            }
+        i=0
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(ref[i], subnode)
+                i=i+1
+
+
+    def _line(self, ref, node):
+        for tag in ('strokeWidth', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('strokeDashArray', ):
+            if node.hasAttribute(tag):
+                attrvalue = [node.getAttribute(tag)]
+                setattr(ref, tag, attrvalue)
+
+        for tag in ('strokeColor', ):
+            if node.hasAttribute(tag):
+                attrvalue = eval('colors.' + node.getAttribute(tag).encode('ascii'))
+                setattr(ref, tag, attrvalue)
+
+
+        for tag in ('symbol', ):
+            if node.hasAttribute(tag):
+                ref.symbol =  makeMarker(node.getAttribute(tag).encode('ascii'))
+        #TODO
+        #shader = AttrMapValue(None, desc='Shader Class.'),
+        #filler = AttrMapValue(None, desc='Filler Class.'),
+
+
+    def _lines(self, ref, node):
+        self._line(ref, node)
+        tags = {
+             'line': self._line,
+            }
+        i=0
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(ref[i], subnode)
+                i=i+1
+
+
+    def _bar(self, ref, node):
+        for tag in ('strokeWidth', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('strokeColor', 'fillColor'):
+            if node.hasAttribute(tag):
+                attrvalue = eval('colors.' + node.getAttribute(tag).encode('ascii'))
+                setattr(ref, tag, attrvalue)
+        #TODO
+        #symbol = AttrMapValue(None, desc='A widget to be used instead of a normal bar.'),
+
+
+    def _bars(self, ref, node):
+        self._bar(ref,node)
+        tags = {
+             'bar': self._bar,
+            }
+        i=0
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(ref[i], subnode)
+                i=i+1
+
+
+    def _slice(self, ref, node):
+        for tag in ('strokeWidth', 'popout', 'fontSize', 'labelRadius', 'label_dx', 'label_dy', 'label_angle', 'label_boxStrokeWidth', \
+                    'label_strokeWidth', 'label_leading', 'label_width', 'label_maxWidth', 'label_height', 'label_topPadding', \
+                    'label_leftPadding', 'label_rightPadding', 'label_bottomPadding', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('fillColor', 'strokeColor', 'fontColor', 'label_boxStrokeColor', 'label_boxFillColor', 'label_strokeColor', ):
+            if node.hasAttribute(tag):
+                attrvalue = eval('colors.' + node.getAttribute(tag).encode('ascii'))
+                setattr(ref, tag, attrvalue)
+
+        for tag in ('fontName', 'label_text', 'label_boxAnchor', 'label_textAnchor', ):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii')
+                setattr(ref, tag, attrvalue)
+
+        for tag in ('strokeDashArray', ):
+            if node.hasAttribute(tag):
+                attrvalue = [node.getAttribute(tag)]
+                setattr(ref, tag, attrvalue)
+
+        for tag in ('label_visible', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.bool_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+
+    def _slices(self, ref, node):
+        self._slice(ref,node)
+        tags = {
+             'slice': self._slice,
+            }
+        i=0
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(ref[i], subnode)
+                i=i+1
+
+
+    def _categoryAxis(self, ref, node):
+        for tag in ('strokeWidth', 'gridStrokeWidth', 'gridStart', 'gridEnd', 'joinAxisPos'):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('visible', 'visibleAxis', 'visibleTicks', 'visibleLabels', 'visibleTicks', 'visibleGrid', 'joinAxis', 'reverseDirection'):
+            if node.hasAttribute(tag):
+                attrvalue = utils.bool_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('style', 'labelAxisMode'):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii')
+                setattr(ref, tag, attrvalue)
+
+        for tag in ('strokeColor', 'gridStrokeColor'):
+            if node.hasAttribute(tag):
+                attrvalue = eval('colors.' + node.getAttribute(tag).encode('ascii'))
+                setattr(ref, tag, attrvalue)
+
+        for tag in ('strokeDashArray', 'gridStrokeDashArray', 'categoryNames'):
+            if node.hasAttribute(tag):
+                attrvalue = eval(node.getAttribute(tag).encode('ascii'))
+                #attrvalue =  node.getAttribute(tag).encode('ascii').split(",")
+                setattr(ref, tag, attrvalue)
+
+        tags = {
+             'labels': self._labels,
+            }
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(getattr(ref, k), subnode)
+
+
+    def _xCategoryAxis(self, ref, node):
+        self._categoryAxis(ref, node)
+
+        for tag in ('tickUp', 'tickDown'):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('joinAxisMode', ):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii')
+                setattr(ref, tag, attrvalue)
+
+
+    def _yCategoryAxis(self, ref, node):
+        self._categoryAxis(ref, node)
+
+        for tag in ('tickLeft', 'tickRight', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('joinAxisMode', ):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii')
+                setattr(ref, tag, attrvalue)
+
+
+    def _valueAxis(self, ref, node):
+        for tag in ('strokeWidth', 'gridStrokeWidth', 'gridStart', 'gridEnd', 'minimumTickSpacing', 'maximumTicks',\
+                    'labelTextScale', 'valueMin', 'valueMax', 'valueStep', 'zrangePref' ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('forceZero', 'visible', 'visibleAxis', 'visibleLabels', 'visibleTicks', 'visibleGrid', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.bool_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('labelTextFormat', 'labelTextPostFormat', 'rangeRound', 'style', 'valueSteps'):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii')
+                setattr(ref, tag, attrvalue)
+
+
+        for tag in ('strokeDashArray', 'gridStrokeDashArray'):
+            if node.hasAttribute(tag):
+                attrvalue = eval(node.getAttribute(tag).encode('ascii'))
+                setattr(ref, tag, attrvalue)
+
+        for tag in ('strokeColor', 'gridStrokeColor'):
+            if node.hasAttribute(tag):
+                attrvalue = eval('colors.' + node.getAttribute(tag).encode('ascii'))
+                setattr(ref, tag, attrvalue)
+
+        tags = {
+             'labels': self._labels,
+            }
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(getattr(ref, k), subnode)
+        #TODO
+        #avoidBoundFrac = AttrMapValue(EitherOr((isNumberOrNone,SequenceOf(isNumber,emptyOK=0,lo=2,hi=2))), desc='Fraction of interval to allow above and below.'),
+
+
+    def _xValueAxis(self, ref, node):
+        self._valueAxis(ref, node)
+
+        for tag in ('tickUp', 'tickDown', 'joinAxisPos'):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('joinAxis', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.bool_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('joinAxisMode', ):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii')
+                setattr(ref, tag, attrvalue)
+
+
+    def _normalDateXValueAxis(self, ref, node):
+        for tag in ('bottomAxisLabelSlack', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('niceMonth','forceEndDate','forceFirstDate','dailyFreq'):
+            if node.hasAttribute(tag):
+                attrvalue = utils.bool_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('xLabelFormat', 'dayOfWeekName', 'monthName'):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii')
+                setattr(ref, tag, attrvalue)
+
+
+    def _yValueAxis(self, ref, node):
+        self._valueAxis(ref, node)
+
+        for tag in ('tickLeft', 'tickRight', 'joinAxisPos'):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('joinAxis', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.bool_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('joinAxisMode', ):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii')
+                setattr(ref, tag, attrvalue)
+
+
+    def _adjYValueAxis(self, ref, node):
+        self._yValueAxis(node)
+
+        for tag in ('requiredRange', 'leftAxisOrigShiftIPC', 'leftAxisOrigShiftMin'):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('leftAxisPercent', 'leftAxisSkipLL0'):
+            if node.hasAttribute(tag):
+                attrvalue = utils.bool_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+
+    def _data(self, ref, node):
+        self.chart.data=eval(node.getAttribute('dataset').encode('ascii'))
+
+
+    def _annotations(self, ref, node):
+        pass
+
+
+    def _plotArea(self, ref, node):
+        for tag in ('x', 'y', 'width', 'height', 'debug'):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+        for tag in ('strokeColor', 'strokeWidth', 'fillColor'):
+            if node.hasAttribute(tag):
+                attrvalue = eval('colors.' + node.getAttribute(tag).encode('ascii'))
+                setattr(ref, tag, attrvalue)
+
+        tags = {
+             'background': self._background,
+            }
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(getattr(ref, k), subnode)
+
+
+    def _linePlot(self, node):
+        self._plotArea(self.chart, node)
+
+        for tag in ('lineLabelNudge', 'joinedLines'):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(self.chart, tag, attrvalue)
+
+        for tag in ('reversePlotOrder', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.bool_get(node.getAttribute(tag))
+                setattr(self.chart, tag, attrvalue)
+
+        for tag in ('lineLabelFormat', ):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii')
+                setattr(self.chart, tag, attrvalue)
+
+        tags = {
+            'data': self._data,
+            'lineLabels': self._lineLabels,
+            'lines': self._lines,
+            'xValueAxis': self._xValueAxis,
+            'yValueAxis': self._yValueAxis,
+            'annotations': self._annotations
+            }
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(getattr(self.chart, k), subnode)
+
+        return self.chart
+
+
+    def _pie(self, node):
+        for tag in ('x', 'y', 'width', 'height', 'startangle', 'other_threshold', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(self.chart,tag,attrvalue)
+
+
+        for tag in ('direction', ):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii')
+                setattr(self.chart, tag, attrvalue)
+
+        for tag in ('simpleLabels', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.bool_get(node.getAttribute(tag))
+                setattr(ref,tag,attrvalue)
+
+
+        for tag in ('labels', ):
+            if node.hasAttribute(tag):
+                attrvalue =  node.getAttribute(tag).encode('ascii').split(",")
+                setattr(ref, tag, attrvalue)
+
+        tags = {
+            'data': self._data,
+            'slices': self._slices
+            }
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(getattr(self.chart, k), subnode)
+
+        return self.chart
+
+
+    def _barChart(self, ref, node):
+        self._plotArea(self.chart, node)
+
+        for tag in ('useAbsolute', 'barWidth', 'groupSpacing', 'barSpacing'):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(self.chart, tag, attrvalue)
+
+        for tag in ('reversePlotOrder', ):
+            if node.hasAttribute(tag):
+                attrvalue = utils.bool_get(node.getAttribute(tag))
+                setattr(self.chart, tag, attrvalue)
+
+        for tag in ('barLabelFormat', ):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii')
+                setattr(self.chart, tag, attrvalue)
+
+        for tag in ('barLabelArray', ):
+            if node.hasAttribute(tag):
+                attrvalue = node.getAttribute(tag).encode('ascii').split(",")
+                setattr(ref, tag, attrvalue)
+
+        tags = {
+             'barLabels': self._barLabels,
+             'bars': self._bars,
+             'data': self._data,
+             'annotations': self._annotations
+            }
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(getattr(self.chart, k), subnode)
+
+    def _horizontalBarChart(self, node):
+        self._barChart(self.chart, node)
+        tags = {
+             'valueAxis': self._xValueAxis,
+             'categoryAxis': self._yCategoryAxis
+             }
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(getattr(self.chart, k), subnode)
+        return self.chart
+
+
+    def _verticalBarChart(self, node):
+        self._barChart(self.chart, node)
+        tags = {
+             'valueAxis': self._yValueAxis,
+             'categoryAxis': self._xCategoryAxis
+             }
+        for k, v in tags.items():
+            for subnode in node.getElementsByTagName(k):
+                v(getattr(self.chart, k), subnode)
+
+        return self.chart
+
+
+    def _barChart3D(self, node):
+        for tag in ('theta_x', 'theta_y', 'zDepth', 'zSpace'):
+            if node.hasAttribute(tag):
+                attrvalue = utils.unit_get(node.getAttribute(tag))
+                setattr(self.chart, tag, attrvalue)
+
+
+    def _horizontalBarChart3D(self, node):
+        self._verticalBarChart(node)
+        self._barChart3D(node)
+
+        return self.chart
+
+
+    def _verticalBarChart3D(self, node):
+        self._horizontalBarChart(node)
+        self._barChart3D(node)
+
+        return self.chart
+
+
+    def _spiderChart(self, node):
+        #TODO
+        return self.chart
+
+
+    def _doughnut(self, node):
+        #TODO
+        return self.chart
+
+
+    def _slideBox(self, node):
+        #TODO
+        return self.chart
+


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trmlextchart.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trmlextfsimage.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trmlextfsimage.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trmlextfsimage.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# trml2pdf - An RML to PDF converter
+# Copyright (C) 2003, Fabien Pinckaers, UCL, FSA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+###############################################################################
+"""Package z3c.pdftemplate.trml2pdf.
+
+$Id: trmlextfsimage.py 2701 2005-07-04 14:25:54Z daniel.meier$
+"""
+
+import os
+import utils
+
+from reportlab.lib.utils import ImageReader 
+
+
+def fsimage(self, node):
+    from reportlab.lib.utils import ImageReader
+    import os
+    imgpath = os.path.join(os.path.dirname(__file__),str(node.getAttribute('file')))
+    img = ImageReader(open(imgpath,'rb'))
+    (sx,sy) = img.getSize()
+
+    args = {}
+    for tag in ('width','height','x','y'):
+        if node.hasAttribute(tag):
+            args[tag] = utils.unit_get(node.getAttribute(tag))
+    if ('width' in args) and (not 'height' in args):
+        args['height'] = sy * args['width'] / sx
+    elif ('height' in args) and (not 'width' in args):
+        args['width'] = sx * args['height'] / sy
+    elif ('width' in args) and ('height' in args):
+        if (float(args['width'])/args['height'])>(float(sx)>sy):
+            args['width'] = sx * args['height'] / sy
+        else:
+            args['height'] = sy * args['width'] / sx
+    self.canvas.drawImage(img, **args)


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/trmlextfsimage.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/utils.py
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/utils.py	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/utils.py	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,65 @@
+# trml2pdf - An RML to PDF converter
+# Copyright (C) 2003, Fabien Pinckaers, UCL, FSA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+import re
+import reportlab
+
+def text_get(node):
+	rc = ''
+	for node in node.childNodes:
+		if node.nodeType == node.TEXT_NODE:
+			rc = rc + node.data
+	return rc
+
+units = [
+	(re.compile('^(-?[0-9\.]+)\s*in$'), reportlab.lib.units.inch),
+	(re.compile('^(-?[0-9\.]+)\s*cm$'), reportlab.lib.units.cm),  
+	(re.compile('^(-?[0-9\.]+)\s*mm$'), reportlab.lib.units.mm),
+	(re.compile('^(-?[0-9\.]+)\s*$'), 1)
+]
+
+def unit_get(size):
+	global units
+	for unit in units:
+		res = unit[0].search(size, 0)
+		if res:
+			return unit[1]*float(res.group(1))
+	return False
+
+def tuple_int_get(node, attr_name, default=None):
+	if not node.hasAttribute(attr_name):
+		return default
+	res = [int(x) for x in node.getAttribute(attr_name).split(',')]
+	return res
+
+def bool_get(value):
+	return (str(value)=="1") or (value.lower()=='yes')
+
+def attr_get(node, attrs, dict={}):
+	res = {}
+	for name in attrs:
+		if node.hasAttribute(name):
+			res[name] =  unit_get(node.getAttribute(name))
+	for key in dict:
+		if node.hasAttribute(key):
+			if dict[key]=='str':
+				res[key] = str(node.getAttribute(key))
+			elif dict[key]=='bool':
+				res[key] = bool_get(node.getAttribute(key))
+			elif dict[key]=='int':
+				res[key] = int(node.getAttribute(key))
+	return res


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/trml2pdf/utils.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-configure.zcml
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-configure.zcml	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-configure.zcml	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1 @@
+<include package="z3c.pdftemplate" />


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-meta.zcml
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-meta.zcml	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-meta.zcml	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1 @@
+<include package="z3c.pdftemplate" file="meta.zcml" />


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-meta.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-sample-configure.zcml
===================================================================
--- z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-sample-configure.zcml	2007-03-08 15:40:12 UTC (rev 73065)
+++ z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-sample-configure.zcml	2007-03-08 15:44:06 UTC (rev 73066)
@@ -0,0 +1,3 @@
+<configure package="z3c.pdftemplate">
+  <include file="sample.zcml" />
+</configure>


Property changes on: z3c.pdftemplate/trunk/src/z3c/pdftemplate/z3c.pdftemplate-sample-configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Checkins mailing list