Created
December 13, 2017 18:27
-
-
Save jduckles/c323c675a359c71595f63361beb3a9b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" Fill SVG templates """ | |
import sys | |
from svglib.svglib import svg2rlg | |
from reportlab.graphics import renderPDF | |
import jinja2 | |
import pyaml | |
def svg2pdf(input_svg,output_pdf): | |
drawing = svg2rlg(input_svg) | |
renderPDF.drawToFile(drawing, output_pdf) | |
def filltemplate(template,context): | |
template = jinaj2.Template(template) | |
return template.render(context) | |
def yaml2dict(yaml_string): | |
return pyaml.loads(yaml_string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment