|
|
|
@ -396,8 +396,16 @@ class Bureau(object):
|
|
|
|
|
print("fetched", url, "in", elapsed)
|
|
|
|
|
return ret
|
|
|
|
|
|
|
|
|
|
weasyprint.HTML(url_fetcher=slowfetch,
|
|
|
|
|
string=templ.render_unicode(**kwargs)).write_pdf(pdfpath)
|
|
|
|
|
html_rendered = weasyprint.HTML(url_fetcher=slowfetch,
|
|
|
|
|
string=templ.render_unicode(**kwargs))
|
|
|
|
|
|
|
|
|
|
if self.log.getEffectiveLevel == logging.DEBUG:
|
|
|
|
|
with html_out as open("/tmp/debug.html", "w"):
|
|
|
|
|
html_out.write(html_rendered)
|
|
|
|
|
self.log.debug("debug html output at /tmp/debug.html")
|
|
|
|
|
|
|
|
|
|
html_rendered.write_pdf(pdfpath)
|
|
|
|
|
self.log.debug("wrote PDF to:", pdfpath)
|
|
|
|
|
subprocess.call("lpr -o sides=two-sided-long-edge -o InputSlot=Upper "
|
|
|
|
|
+ pdfpath, shell=True)
|
|
|
|
|
|
|
|
|
|