miikanissi/zebrafy

Multipage PDF printing on one label ZT230 Label printer

Closed this issue · 0 comments

Hi as the title suggest I have a multi-page pdf that I use to print on my ZT230 but I am getting an issue running it through your code , generating the ZPL code and then sending it to the printer.
Maybe you can assist.

def send_zpl_data(pdf_data, printer_socket: socket.socket, scaling_params):
"""Convert PDF data to ZPL format and send to the printer."""
try:

    x, y = scaling_params# 4,4
    zpl_string = ZebrafyPDF(
        pdf_data,
        format="ASCII",
        invert=True,
        width=x,
        height=y,
        pos_x=0,
        pos_y=0,
    ).to_zpl()
    printer_socket.sendall(zpl_string.encode())
except Exception as e:
    print(f"Error sending ZPL data: {e}")