############################################################################## # # Copyright (c) 2007 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 Converter """ import cStringIO import os import sys import zope.interface from lxml import etree from z3c.rml import document, interfaces zope.interface.moduleProvides(interfaces.IRML2PDF) def parseString(xml, removeEncodingLine=True, filename=None): if isinstance(xml, unicode) and removeEncodingLine: # RML is a unicode string, but oftentimes documents declare their # encoding using . Unfortuantely, I cannot tell lxml to # ignore that directive. Thus we remove it. if xml.startswith('