================== RML Page Templates ================== This package also provides optional support a helper class to use page templates with RML without using the entire Zope framework. This document will demonstrate how to use page templates and RML together. In this example, we will simply iterate through a list of names and display them in the PDF. The first step is to create a page template: >>> import tempfile >>> ptFileName = tempfile.mktemp('.pt') >>> open(ptFileName, 'w').write('''\ ... ... ... ... ... ... ... ... ... ... ... ... ''') The ``context`` namespace will be created during rendering. I get back to this later. In th enext step we instantiate the page template: >>> from z3c.rml import pagetemplate >>> rmlPageTemplate = pagetemplate.RMLPageTemplateFile(ptFileName) All we have to do now is to render the template. The context of the template is effectively the keyword arguments dictionary: >>> rmlPageTemplate(names=(u'Roy', u'Daniel', u'Julian', u'Stephan')) '%PDF-1.4...' You can uncomment the following line to write out the PDF in the current working directory: #>>> open('pagetemplate-test.pdf', 'w').write( #... rmlPageTemplate(names=(u'Roy', u'Daniel', u'Julian', u'Stephan')))