Skip to content

Commit

Permalink
need to specify no-sandbox to work with current dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
tobru committed Sep 10, 2024
1 parent 13e9344 commit 2874beb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions contactform/label_raffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,22 @@ def print_raffle(form, config, printer_config):
</div>
"""

hti = Html2Image(size=(590, 300), output_path="/tmp")
hti = Html2Image(
size=(590, 300),
output_path="/tmp",
custom_flags=[
"--default-background-color=000000",
"--hide-scrollbars",
"--no-sandbox",
],
)
hti.screenshot(
html_str=label_html,
css_str=label_css,
save_as=label_filename,
)

label_image = open(f"/tmp/html2image/{label_filename}", "rb")
label_image = open(f"/tmp/{label_filename}", "rb")

parameters = LabelParameters(
configuration=printer_config,
Expand Down
12 changes: 10 additions & 2 deletions contactform/label_voucher.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,15 @@ def print_voucher(form, voucher_code, config, printer_config):
scale=5,
)

hti = Html2Image(size=(590, 1050), output_path="/tmp")
hti = Html2Image(
size=(590, 1050),
output_path="/tmp",
custom_flags=[
"--default-background-color=000000",
"--hide-scrollbars",
"--no-sandbox",
],
)
hti.load_file(config.APPUIO_LOGO_PATH)
hti.load_file(qr_code_filename)
hti.browser.print_command = True if config.LOG_LEVEL == "DEBUG" else False
Expand All @@ -72,7 +80,7 @@ def print_voucher(form, voucher_code, config, printer_config):
save_as=label_filename,
)

label_image = open(f"/tmp/html2image/{label_filename}", "rb")
label_image = open(f"/tmp/{label_filename}", "rb")

parameters = LabelParameters(
configuration=printer_config,
Expand Down

0 comments on commit 2874beb

Please sign in to comment.