Fix printing via printservant

pull/4/head
radex 2024-02-07 17:47:58 +01:00
parent 17fedfbc96
commit 70f257ee06
Signed by: radex
SSH Key Fingerprint: SHA256:hvqRXAGG1h89yqnS+cyFTLKQbzjWD4uXIqw7Y+0ws30
1 changed files with 7 additions and 4 deletions

View File

@ -88,10 +88,13 @@ def stuff_print(size):
renderer.render_text(text, 'Sans {}'.format(size), 0, -1, html) renderer.render_text(text, 'Sans {}'.format(size), 0, -1, html)
data = renderer.surface.write_to_png() data = renderer.surface.write_to_png()
payload = {'printer': 'dymo_labelwriter450', 'copies': 1, 'body': data} response = requests.post(
r = requests.post(os.environ.get('PRINTSERVANT_HOST') + '/print', params=payload) os.environ.get('PRINTSERVANT_HOST') + '/print',
print('Printing job response', r.text) params={'printer': 'dymo', 'copies': 1},
data=data,
headers={'Content-Type': 'image/png'},
)
print('Printing job response', response)
return 'ok' return 'ok'
def main(): def main():