|
|
|
@ -384,8 +384,14 @@ class Bureau(object):
|
|
|
|
|
pdfpath = tempfile.mkstemp(".pdf")[1]
|
|
|
|
|
self.log.debug("rendering to: " + pdfpath)
|
|
|
|
|
|
|
|
|
|
weasyprint.HTML(string=templ.render_unicode(**kwargs)).write_pdf(pdfpath)
|
|
|
|
|
subprocess.call("lpr -o sides=two-sided-long-edge -o InputSlot=Upper " + pdfpath, shell=True)
|
|
|
|
|
# use an URL fetcher that waits 30s instead of 10s
|
|
|
|
|
def slowfetch(url, timeout=30, ssl_context=None):
|
|
|
|
|
return weasyprint.default_url_fetcher(url, 30, ssl_context)
|
|
|
|
|
|
|
|
|
|
weasyprint.HTML(url_fetcher=slowfetch,
|
|
|
|
|
string=templ.render_unicode(**kwargs)).write_pdf(pdfpath)
|
|
|
|
|
subprocess.call("lpr -o sides=two-sided-long-edge -o InputSlot=Upper "
|
|
|
|
|
+ pdfpath, shell=True)
|
|
|
|
|
|
|
|
|
|
# TODO: make this asynchronous
|
|
|
|
|
def print_small(self, text, cut=True):
|
|
|
|
|