Giter VIP home page Giter VIP logo

python-brotherprint's Introduction

WARNING: This project is not actively maintained, use at your own risk. Seeking new maintainer

python-brotherprint

Brother networked label printers library for Python

This was developed for the QL-580N but I've heard it also works for the following:

  • QL-720NW

Installation

The easiest way to install this package is with pip.

pip install brotherprint

Usage

This library supports two printing modes. ESC/P commands, and templates. I highly recommend using templates, because it is easier to manage, and offers more features. I will, however, go over both. You should review the official Brother documentation here (ESCP Docs) and here (Template Command Docs), to know what is available.

Setup

Regardless of which mode you are using, you need to intialize and connect a socket object, and pass the resulting socket object to the BrotherLabel object instantiator.

from brotherprint import BrotherPrint
from socket
f_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
f_socket.connect(('<ip_address>', <port (9100 by default for QL580N)>))
printjob = BrotherPrint(f_socket)

ESC/P Printing

Invoke escp commands through certain BrotherLabel object methods (see actual file for method descriptions) Make sure to end with the print page command, signifying the end of a label.

printjob.command_mode()
printjob.initialize()
printjob.bold('on')
printjob.send(<text>)
printjob.print_page(<cut_setting>)

Template Printing

Create your template and upload it to the printer. After creating a BrotherLabel object, call template_mode() to set the printer to template mode, and then use the template commands to fill in your label. Be sure to download the P-Touch Template Tools from support.brother.com under utilities of your label printer. It has a wealth of information.

printjob.template_mode()
printjob.template_init()
printjob.choose_template(<template_number>)
printjob.select_and_insert(<field_name>, <data>)
printjob.select_and_insert(<field_name2>, <data2>)
printjob.select_and_insert(<field_name3>, <data3>)
# For QL-720NW with barcodes on label, turn on:
# printjob.select_priority_print_option('on')
printjob.template_print()

python-brotherprint's People

Stargazers

 avatar

Watchers

 avatar

Forkers

lilyfoote

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.