Label: Changed defaults and barcode size
This commit is contained in:
parent
7e977881b4
commit
2f6aca3c0d
|
@ -105,12 +105,13 @@ class ContainerPrintLabelView(LoginRequiredMixin, generic.DetailView):
|
||||||
fmt='image',
|
fmt='image',
|
||||||
description=container_description,
|
description=container_description,
|
||||||
description_line2=container_description_line2,
|
description_line2=container_description_line2,
|
||||||
writer_options={'font_size': 14,
|
writer_options={})
|
||||||
|
'''writer_options={'font_size': 14,
|
||||||
'module_height': 10.0,
|
'module_height': 10.0,
|
||||||
'quiet_zone': 4.5,
|
'quiet_zone': 4.5,
|
||||||
'text': 'This is the text',
|
'text': 'This is the text',
|
||||||
'text_distance': 1.0
|
'text_distance': 1.0
|
||||||
})
|
})'''
|
||||||
context['barcode_img'] = pil_to_html_imgdata(label_image, fmt='PNG')
|
context['barcode_img'] = pil_to_html_imgdata(label_image, fmt='PNG')
|
||||||
context['logs'].append('Image created')
|
context['logs'].append('Image created')
|
||||||
if num_copies > 0:
|
if num_copies > 0:
|
||||||
|
|
|
@ -110,7 +110,15 @@ def container_label(data, barcode_class='code128', fmt='png', logo_file='./stati
|
||||||
'image': python_barcode.writer.ImageWriter
|
'image': python_barcode.writer.ImageWriter
|
||||||
}[fmt]
|
}[fmt]
|
||||||
barcode_img = constructor(data, writer=writer())
|
barcode_img = constructor(data, writer=writer())
|
||||||
img = barcode_img.render(writer_options=options['writer_options'])
|
writer_options = {
|
||||||
|
'font_size': 24,
|
||||||
|
'module_width': 0.25,
|
||||||
|
'module_height': 10,
|
||||||
|
'quiet_zone': 3,
|
||||||
|
'text_distance': 1.0
|
||||||
|
}
|
||||||
|
writer_options.update(options['writer_options'])
|
||||||
|
img = barcode_img.render(writer_options=writer_options)
|
||||||
barcode_xsize, barcode_ysize = img.size
|
barcode_xsize, barcode_ysize = img.size
|
||||||
logo_xsize, logo_ysize = logo_img.size
|
logo_xsize, logo_ysize = logo_img.size
|
||||||
label_xsize = 696
|
label_xsize = 696
|
||||||
|
|
Loading…
Reference in New Issue