Code snippets are bits of re-usable code submitted by the ReportLab community. We don't promise that they are accurate, up-to-date or correct - use them at your own risk!
We'd love it if you could participate by submitting your own snippets and sharing your experience with others by commenting. You will need to create a user account by filling out our very simple form.
View all snippets
Creating a PDF on disk from RML (XML)
Uses the rml2pdf.go function to generate a PDF document on disk from an RML source.
RML2PDF is a central component of ReportLab PLUS: a translator which converts high level XML markup into PDF documents. Report Markup Language describes the precise layout of a printed document, and RML2PDF converts this to a finished document in one step.
See the RML User Guide for more information about RML.
from rlextra.rml2pdf import rml2pdf rml = getRML() # Use your favorite templating laguage here to create the RML string output = '/tmp/output.pdf' rml2pdf.go(rml, outputFileName=output)