diff --git a/CHANGES.rst b/CHANGES.rst index 5745b60..3bb1ffc 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,10 +2,13 @@ CHANGES ======= -2.2.2 (unreleased) +2.3.0 (unreleased) ------------------ -- Nothing changed yet. +- Added ``title``, ``subject``, ``author``, and ``creator`` attributes to + ``document`` element. Those are set as PDF annotations, which are now + commonly used to hint viewers window titles, etc. (Those fields are not + available in RML2PDF.) 2.2.1 (2013-08-06) diff --git a/buildout.cfg b/buildout.cfg index 23aaf6a..7779080 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -6,7 +6,7 @@ parts = test coverage-test coverage-report scripts python [test] -recipe = zc.recipe.testrunner +recipe = zc.recipe.testrunner>=2.0 eggs = z3c.rml [test] [coverage-test] diff --git a/setup.py b/setup.py index 93afc9f..1da3308 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ def alltests(): setup ( name='z3c.rml', - version='2.2.2.dev0', + version='2.3.0.dev0', author="Stephan Richter and the Zope Community", author_email="zope-dev@zope.org", description="An alternative implementation of RML", diff --git a/src/z3c/rml/document.py b/src/z3c/rml/document.py index be12426..b291cf7 100644 --- a/src/z3c/rml/document.py +++ b/src/z3c/rml/document.py @@ -576,6 +576,26 @@ class IDocument(interfaces.IRMLDirectiveSignature): u'file was provided.'), required=True) + title = attr.String( + title=u'Title', + description=(u'The "Title" annotation for the PDF document.'), + required=False) + + subject = attr.String( + title=u'Subject', + description=(u'The "Subject" annotation for the PDF document.'), + required=False) + + author = attr.String( + title=u'Author', + description=(u'The "Author" annotation for the PDF document.'), + required=False) + + creator = attr.String( + title=u'Creator', + description=(u'The "Creator" annotation for the PDF document.'), + required=False) + debug = attr.Boolean( title=u'Debug', description=u'A flag to activate the debug output.', @@ -644,6 +664,13 @@ def _initCanvas(self, canvas): for name, option in DocInit.viewerOptions.items(): if getattr(self, name) is not None: canvas.setViewerPreference(option, getattr(self, name)) + # Setting annotations. + data = dict(self.getAttributeValues( + select=('title', 'subject', 'author', 'creator'))) + canvas.setTitle(data.get('title')) + canvas.setSubject(data.get('subject')) + canvas.setAuthor(data.get('author')) + canvas.setCreator(data.get('creator')) def process(self, outputFile=None, maxPasses=2): """Process document""" diff --git a/src/z3c/rml/rml-reference.pdf b/src/z3c/rml/rml-reference.pdf index 1b3a1f1..6b69059 100644 Binary files a/src/z3c/rml/rml-reference.pdf and b/src/z3c/rml/rml-reference.pdf differ diff --git a/src/z3c/rml/rml.dtd b/src/z3c/rml/rml.dtd index ce6bdc4..e539e53 100644 --- a/src/z3c/rml/rml.dtd +++ b/src/z3c/rml/rml.dtd @@ -1,6 +1,10 @@ + + + +