2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-06 05:30:56 +00:00

Label dpi config (#3208)

* Updates for label printing settings:

- Make LABEL_ENABLE a global setting
- Add LABEL_DPI setting (default = 300)
- Add new global settings tab

* Use the configured DPI when printing labels
This commit is contained in:
Oliver
2022-06-16 14:49:17 +10:00
committed by GitHub
parent 9bd62f986f
commit d84b67ddf4
7 changed files with 44 additions and 9 deletions

View File

@ -8,6 +8,7 @@ from django.utils.translation import gettext_lazy as _
import pdf2image
import common.notifications
from common.models import InvenTreeSetting
from InvenTree.exceptions import log_error
from plugin.registry import registry
@ -36,9 +37,10 @@ def print_label(plugin_slug: str, pdf_data, filename=None, label_instance=None,
return
# In addition to providing a .pdf image, we'll also provide a .png file
dpi = InvenTreeSetting.get_setting('LABEL_DPI', 300)
png_file = pdf2image.convert_from_bytes(
pdf_data,
dpi=300,
dpi=dpi,
)[0]
try: