{ "info": { "author": "Stephan Richter and the Zope Community", "author_email": "zope-dev@zope.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Zope3", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP" ], "description": "Quickly generate PDF files using page templates and RML.\n\n\n.. contents::\n\n=====================================\nUsing ReportLab to generate PDF Views\n=====================================\n\nThis package,\n\n >>> import z3c.pdftemplate\n\nprovides the functionality of creating browser views that generate PDFs\ninstead of HTML using reportlab's PDF writer technology. There are several\nways to use the features in this package, which are demonstrated in the text\nbelow.\n\nBut first we have to load the directives' meta configuration:\n\n >>> import zope.component\n >>> from zope.publisher.browser import TestRequest\n >>> from zope.configuration import xmlconfig\n >>> context = xmlconfig.file('meta.zcml', package=z3c.pdftemplate)\n\n\nUsing ``z3c.rml`` and ReportLab to generate PDF Views\n-----------------------------------------------------\n\nSee DEPENDENCIES.cfg, this lib depends on some 3rd party libraries.\n\n\nPurpose: PDF-Generration with the help of ``z3c.rml`` (an open source\nimplementation of RML) and Reportlab. The ``z3c.rml`` is really a dialect of\nthe official RML and supports many more features, such as charting while still\nremaining compatible with the commercial version of RML as much as possible.\n\nThis package provides the functionality of creating browser views that\ngenerate PDFs instead of HTML using reportlab's PDF writer technology.\n\nBut first we have to load the directives' meta configuration:\n\n >>> from zope.configuration import xmlconfig\n >>> context = xmlconfig.file('meta.zcml', package=z3c.pdftemplate)\n\nRML, an XML-dialect developed by Reportlab.org, is much like HTML in that it\nlets you define the structure of a PDF document. The RML is dynamically\ngenerated using page templates and then used to generate a PDF file.\n\nLet's say we want to create a PDF that shows the contents of a folder. The\nfirst step is to create a rml-document that contains the structure of the\nPDF. The following folder contents document template is available in\n``rml_contents.pt``\n\n::\n\n \n \n \n \n\n \n Folder Name:\n \n <no name>\n \n\n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
NameTitleSizeCreatedModified
me.png<no title>34.5 kB
\n\n \n\n
\n \n\nPretty easy isn't it? Fortunately, we can simply reuse the ``Contents`` view\nclass for the HTML contents view.\n\nNow that we have the template and the document, we can simply register the\nview:\n\n >>> context = xmlconfig.string(\"\"\"\n ... \n ... \n ... \n ... \"\"\", context)\n\nOnce we have created a folder instance:\n\n >>> from zope.app.folder.folder import Folder\n >>> folder = Folder()\n >>> folder.__name__ = 'my folder'\n >>> folder['subFolder'] = Folder()\n\nwe can can look up the view\n\n >>> class Principal:\n ... id = 'bob'\n\n >>> request = TestRequest()\n >>> request.setPrincipal(Principal())\n\n >>> contents = zope.component.getMultiAdapter((folder, request),\n ... name=\"rmlsample.pdf\")\n\nand create the PDF:\n\n >>> contents() #doctest: +ELLIPSIS\n '%PDF-1.4...'\n\n\n=======\nCHANGES\n=======\n\n0.2.0 (2010-12-12)\n------------------\n\n- Added missing install dependencies and test dependencies.\n\n- Fixed tests to run with current package versions.\n\n- Adapted tests to `reportlab` 2.4+ which produces PDF 1.4, so requiring at\n least this `reportlab` version.\n\n- Using python's `doctest` module instead of the deprecated\n `zope.testing.doctest`.\n\n- Removed ZCML slugs and ZPKG ones.\n\n- Fixed REST of ``long_description``.\n\n\n0.1.0 (2008-02-15)\n------------------\n\n- Initial Release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/z3c.pdftemplate", "keywords": "zope3 pdf rml reportlab template", "license": "ZPL 2.1", "maintainer": null, "maintainer_email": null, "name": "z3c.pdftemplate", "package_url": "https://pypi.org/project/z3c.pdftemplate/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/z3c.pdftemplate/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/z3c.pdftemplate" }, "release_url": "https://pypi.org/project/z3c.pdftemplate/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "PDF Template", "version": "0.2.0" }, "last_serial": 802062, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "9f7a4d64104d87c905a241a349d56f3c", "sha256": "ddce3e90a3ded24d1cbe485bb220956346bdec6819913fd089c19769839a6943" }, "downloads": -1, "filename": "z3c.pdftemplate-0.1.0.tar.gz", "has_sig": false, "md5_digest": "9f7a4d64104d87c905a241a349d56f3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 369123, "upload_time": "2008-02-15T07:58:30", "url": "https://files.pythonhosted.org/packages/24/4b/db63c946a81c94f9e91492e82648d722ec9000d708c11559ef2a78da5f8b/z3c.pdftemplate-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "04ba7f70d006def8d39cbf590f2e0d93", "sha256": "80560e7f0588d46eb8a5622201d6de9139bb798eeefee711844b9513499fe732" }, "downloads": -1, "filename": "z3c.pdftemplate-0.2.0.tar.gz", "has_sig": false, "md5_digest": "04ba7f70d006def8d39cbf590f2e0d93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 363510, "upload_time": "2010-12-12T17:45:12", "url": "https://files.pythonhosted.org/packages/e2/47/b8c20c8fa1e6268de3e684243cf5dfab284fbfc984a637e5b0c487ff0f36/z3c.pdftemplate-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "04ba7f70d006def8d39cbf590f2e0d93", "sha256": "80560e7f0588d46eb8a5622201d6de9139bb798eeefee711844b9513499fe732" }, "downloads": -1, "filename": "z3c.pdftemplate-0.2.0.tar.gz", "has_sig": false, "md5_digest": "04ba7f70d006def8d39cbf590f2e0d93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 363510, "upload_time": "2010-12-12T17:45:12", "url": "https://files.pythonhosted.org/packages/e2/47/b8c20c8fa1e6268de3e684243cf5dfab284fbfc984a637e5b0c487ff0f36/z3c.pdftemplate-0.2.0.tar.gz" } ] }