try to support embedded fonts

workspace
Brendan Howell 6 years ago
parent 071292d1df
commit 6ee6438747

@ -15,6 +15,7 @@ import threading
import lmdb
import PIL
import weasyprint
from weasyprint.fonts import FontConfiguration
import zmq
from escpos import printer
from mako.template import Template
@ -322,7 +323,8 @@ class Bureau(object):
# TODO: make paper size a config variable
pdfpath = tempfile.mkstemp(".pdf")[1]
self.log.debug("rendering to: " + pdfpath)
weasyprint.HTML(string=templ.render_unicode(**kwargs)).write_pdf(pdfpath)
fontconfig = FontConfiguration()
weasyprint.HTML(string=templ.render_unicode(**kwargs)).write_pdf(pdfpath, font_config=fontconfig)
subprocess.call("lpr -o sides=two-sided-long-edge -o InputSlot=Upper " + pdfpath, shell=True)
# TODO: make this asynchronous

Loading…
Cancel
Save