Quantcast
Channel: Active questions tagged feed - Stack Overflow
Viewing all articles
Browse latest Browse all 542

Margin (feed_margin) problem with brother_ql from Python

$
0
0

I have a script that uses the brother_ql module to print out stickers.

The script creates an appropriately sized PNG file (width of 696px, and the height varies depending on the template). The PNG is then sent to the Brother QL-820NWB printer. Everything works fine except that the top and bottom of the sticker have an additional margin added to them.

The width looks correct, but the length has extra padding on the top and bottom. I can't figure out how to get rid of it.

The relevant code looks like this:

from brother_ql.conversion import convertfrom brother_ql.backends.helpers import sendfrom brother_ql.raster import BrotherQLRasterdef print_label_from_png(png_in, delete_after_print=True):    printerdata_model = 'QL-820NWB'    qlr = BrotherQLRaster(printerdata_model)    qlr.exception_on_warning = True    #qlr.mlength = 0 # Trying to kill the margins    #qlr.mlength(0) # Trying to kill the margins    #qlr.mwidth = 0     # Trying to kill the margins    instructions = convert(            qlr=qlr,             images=[png_in],    #  Takes a list of file names or PIL objects.            label='62red',            rotate='auto',      # 'Auto', '0', '90', '270'            threshold=70.0,     # Black and white threshold in percent.            dither=False,             compress=False,             red=True,           # Only True if using Red/Black 62 mm label tape.            dpi_600=False,             hq=True,            # False for low quality.            cut=True    )    # The "feed_margin" data is taken from the label. In this case, the "62red" has a margin of 35. This is then called in convert() where: qlr.add_margins(label_specs['feed_margin'])    # I tried to then set it here with 0, but it seems to do nothing...    qlr.add_margins(0)     qlr.mlength = 0    it_worked = send_data_to_printer(instructions) # This just adds the printer IP and tells it to send the request via the network.    if (delete_after_print): os.remove(png_in)    return it_worked

Viewing all articles
Browse latest Browse all 542

Trending Articles