Printer Module

The printer module provides the base printer class and printer implementations for specific Brother P-touch models.

Base Printer Class

Base class for Brother P-touch label printers.

class ptouch.printer.TapeConfig(left_pins, print_pins, right_pins)[source]

Bases: object

Pin configuration for a specific printer/tape combination.

left_pins

Number of unused pins on the left margin.

Type:

int

print_pins

Number of pins in the printable area.

Type:

int

right_pins

Number of unused pins on the right margin.

Type:

int

left_pins: int
print_pins: int
right_pins: int
__init__(left_pins, print_pins, right_pins)
class ptouch.printer.MediaType(*values)[source]

Bases: Enum

Media type identifiers for Brother P-touch printers.

NO_MEDIA = 0
LAMINATED_TAPE = 1
NONLAMINATED_TAPE = 3
HEATSHRINK_TUBE_21 = 17
HEATSHRINK_TUBE_31 = 23
INCOMPATIBLE_TAPE = 255
class ptouch.printer.LabelPrinter(connection, use_compression=None, high_resolution=None)[source]

Bases: ABC

Abstract base class for Brother P-touch label printers.

Subclasses must define the following class attributes:

TOTAL_PINS

Total number of print head pins.

Type:

int

BYTES_PER_LINE

Number of bytes per raster line.

Type:

int

RESOLUTION_DPI

Base (vertical) resolution in DPI.

Type:

int

RESOLUTION_DPI_HIGH

High (horizontal) resolution in DPI when enabled.

Type:

int

DEFAULT_USE_COMPRESSION

Whether to use TIFF compression by default.

Type:

bool

PIN_CONFIGS

Dict mapping tape type to TapeConfig.

Type:

dict[type[Tape], TapeConfig]

TOTAL_PINS: int
BYTES_PER_LINE: int
RESOLUTION_DPI: int
RESOLUTION_DPI_HIGH: int = 0
DEFAULT_USE_COMPRESSION: bool
PIN_CONFIGS: dict[type[Tape], TapeConfig]
SUPPORTS_AUTO_CUT: bool = True
SUPPORTS_HALF_CUT: bool = True
SUPPORTS_PAGE_NUMBER_CUTS: bool = True
SUPPORTS_MIRROR_PRINT: bool = True
SUPPORTS_CHAIN_PRINTING: bool = True
SUPPORTS_SPECIAL_TAPE: bool = True
DEFAULT_AUTO_CUT: bool = True
DEFAULT_HALF_CUT: bool = True
DEFAULT_HIGH_RESOLUTION: bool = False
DEFAULT_PAGE_NUMBER_CUTS: bool = False
DEFAULT_MIRROR_PRINT: bool = False
DEFAULT_CHAIN_PRINTING: bool = False
DEFAULT_SPECIAL_TAPE: bool = False
property supports_high_resolution: bool

Whether the printer supports high resolution mode.

property supported_tapes: list[type[Tape]]

Get list of tape types supported by this printer.

Returns:

List of supported tape classes, sorted by name.

Return type:

list[type[Tape]]

MIN_MARGIN_MM: float = 2.0
MAX_MARGIN_MM: float = 127.0
DEFAULT_MARGIN_MM: float = 2.0
__init__(connection, use_compression=None, high_resolution=None)[source]

Initialize the label printer.

Parameters:
  • connection (Connection) – Connection to the printer (USB or network).

  • use_compression (bool | None) – Whether to use TIFF compression. Defaults to class setting.

  • high_resolution (bool | None) – Whether to use high resolution mode. Defaults to class setting.

get_tape_config(tape)[source]

Get the tape configuration for a given tape.

Parameters:

tape (Tape) – The tape to get configuration for.

Returns:

Pin configuration for the tape.

Return type:

TapeConfig

Raises:

ValueError – If the tape type is not supported by this printer.

precut(tape)[source]

Trigger a feed-and-cut without printing any content.

Sends the standard page-control sequence with zero raster lines and auto-cut enabled, then 0x1A (print and feed). The printer feeds the ~24 mm of tape currently between the print head and the cutter and cuts, ejecting it as a small leader scrap. The next print then starts from a fresh cut edge, with no blank leader on the real label.

This is what Brother’s official driver does at the start of a print operation to give clean leader-free output.

Parameters:

tape (Tape) – Tape currently loaded — used only to populate the page-info command with the correct media type and width.

Return type:

None

print(label, margin_mm=None, high_resolution=None, feed=True, auto_cut=None, half_cut=None, mirror=None, chain=None, special_tape=None)[source]

Print a label using column-by-column raster format.

Parameters:
  • label (Label) – Label to print (contains image and tape information).

  • margin_mm (float | None) – Margin in millimeters. Valid range: MIN_MARGIN_MM to MAX_MARGIN_MM. If None, uses DEFAULT_MARGIN_MM.

  • high_resolution (bool | None) – Whether to use high resolution mode. If None, uses printer’s setting.

  • feed (bool) – If True, sends 0x1A (print and feed). If False, sends 0x0C (print without feed) - used for multi-label printing.

  • auto_cut (bool | None) – Override auto-cut setting. If None, uses DEFAULT_AUTO_CUT. Used by print_multi() for half-cut mode.

  • half_cut (bool | None) – Override half-cut setting. If None, uses DEFAULT_HALF_CUT. Used by print_multi() for half-cut mode.

  • mirror (bool | None) – Enable mirror printing. If None, uses DEFAULT_MIRROR_PRINT. Useful for transparent / iron-on tape where the image must be reversed.

  • chain (bool | None) – Enable chain printing. If None, uses DEFAULT_CHAIN_PRINTING. When True, the printer skips the final feed + full-cut after this page so the next print job continues without a leader feed. Each job in the chain must opt in explicitly.

  • special_tape (bool | None) – Enable special-tape no-cut mode. If None, uses DEFAULT_SPECIAL_TAPE. Effect is conditional on the loaded cassette being non-laminated decorative tape.

Raises:

ValueError – If the label’s tape type is not supported by this printer, or if a feature (auto_cut, half_cut, mirror, chain, special_tape) is explicitly requested but the printer model does not support it (see the SUPPORTS_* class attributes).

Return type:

None

print_multi(labels, margin_mm=None, high_resolution=None, half_cut=True, precut=False, mirror=None, chain=None, special_tape=None)[source]

Print multiple labels with cuts between and after last.

This method prints multiple labels in sequence by calling print() for each label with appropriate parameters.

Parameters:
  • labels (list[Label]) – List of labels to print. All labels must use the same tape type.

  • margin_mm (float | None) – Margin in millimeters. Valid range: MIN_MARGIN_MM to MAX_MARGIN_MM. If None, uses DEFAULT_MARGIN_MM.

  • high_resolution (bool | None) – Whether to use high resolution mode. If None, uses printer’s setting.

  • half_cut (bool) –

    If True, use half-cuts between labels (saves tape). If False, request full cuts between all labels.

    Note: on many Brother PT-series printers the full-cutter blade is downstream of the print head, so cuts between pages of a multi-page job (sent with feed=False / 0x0C) cannot physically reach the cutter and degrade to half-cuts at the print-head position. In practice this means half_cut=False and half_cut=True often produce indistinguishable output (half-cuts between, full-cut at end). To get true separate full-cut labels, issue N independent print() calls — each pays a leader-feed but yields a fully-cut label.

  • mirror (bool | None) – Enable mirror printing on every label. Forwarded to print().

  • chain (bool | None) – Enable chain printing on every label. Forwarded to print(). When True, the final label of the job will NOT feed/full-cut, leaving the chain open for the next print_multi() / print() call.

  • special_tape (bool | None) – Enable special-tape no-cut mode on every label. Forwarded to print().

Raises:

ValueError – If labels list is empty, tape types don’t match, or tape is unsupported.

Return type:

None

Printer Implementations

Concrete printer implementations for Brother P-touch label printers.

class ptouch.printers.PTE550W(connection, use_compression=None, high_resolution=None)[source]

Bases: LabelPrinter

Brother PT-E550W label printer (128 pins, 180 DPI).

Note: E550W requires compression ON for cutting to work. High resolution mode (180x360 dpi) is supported via ESC i K bit 6. In high-res mode, each raster line must be sent twice and margin doubled.

USB_PRODUCT_ID = 8288
TOTAL_PINS: int = 128
BYTES_PER_LINE: int = 16
RESOLUTION_DPI: int = 180
RESOLUTION_DPI_HIGH: int = 360
DEFAULT_USE_COMPRESSION: bool = True
PIN_CONFIGS: dict[type[Tape], TapeConfig] = {<class 'ptouch.tape.HeatShrinkTube11_7mm'>: TapeConfig(left_pins=33, print_pins=66, right_pins=29), <class 'ptouch.tape.HeatShrinkTube17_7mm'>: TapeConfig(left_pins=13, print_pins=106, right_pins=9), <class 'ptouch.tape.HeatShrinkTube23_6mm'>: TapeConfig(left_pins=0, print_pins=128, right_pins=0), <class 'ptouch.tape.HeatShrinkTube3_1_11_2mm'>: TapeConfig(left_pins=41, print_pins=50, right_pins=37), <class 'ptouch.tape.HeatShrinkTube3_1_21_0mm'>: TapeConfig(left_pins=6, print_pins=120, right_pins=2), <class 'ptouch.tape.HeatShrinkTube3_1_5_2mm'>: TapeConfig(left_pins=56, print_pins=20, right_pins=52), <class 'ptouch.tape.HeatShrinkTube3_1_9_0mm'>: TapeConfig(left_pins=44, print_pins=44, right_pins=40), <class 'ptouch.tape.HeatShrinkTube5_8mm'>: TapeConfig(left_pins=52, print_pins=28, right_pins=48), <class 'ptouch.tape.HeatShrinkTube8_8mm'>: TapeConfig(left_pins=42, print_pins=48, right_pins=38), <class 'ptouch.tape.Tape12mm'>: TapeConfig(left_pins=29, print_pins=70, right_pins=29), <class 'ptouch.tape.Tape18mm'>: TapeConfig(left_pins=8, print_pins=112, right_pins=8), <class 'ptouch.tape.Tape24mm'>: TapeConfig(left_pins=0, print_pins=128, right_pins=0), <class 'ptouch.tape.Tape3_5mm'>: TapeConfig(left_pins=52, print_pins=24, right_pins=52), <class 'ptouch.tape.Tape6mm'>: TapeConfig(left_pins=48, print_pins=32, right_pins=48), <class 'ptouch.tape.Tape9mm'>: TapeConfig(left_pins=39, print_pins=50, right_pins=39)}
class ptouch.printers.PTP750W(connection, use_compression=None, high_resolution=None)[source]

Bases: PTE550W

Brother PT-P750W label printer (128 pins, 180 DPI).

Inherits all settings from PTE550W.

USB_PRODUCT_ID = 8293
class ptouch.printers.PTP710BT(connection, use_compression=None, high_resolution=None)[source]

Bases: PTE550W

Brother PT-P710BT label printer (128 pins, 180 DPI, Bluetooth/USB).

Same raster protocol as PT-E550W / PT-P750W (covered by the same Brother spec document: cv_pte550wp750wp710bt_eng_raster_102.pdf).

Note: PT-P710BT supports only laminated TZe tapes — no heat shrink tubes (HSe series) and no 36 mm tape (the 128-pin head caps at 24 mm).

USB_PRODUCT_ID = 8367
SUPPORTS_HALF_CUT: bool = False
DEFAULT_HALF_CUT: bool = False
PIN_CONFIGS: dict[type[Tape], TapeConfig] = {<class 'ptouch.tape.Tape12mm'>: TapeConfig(left_pins=29, print_pins=70, right_pins=29), <class 'ptouch.tape.Tape18mm'>: TapeConfig(left_pins=8, print_pins=112, right_pins=8), <class 'ptouch.tape.Tape24mm'>: TapeConfig(left_pins=0, print_pins=128, right_pins=0), <class 'ptouch.tape.Tape3_5mm'>: TapeConfig(left_pins=52, print_pins=24, right_pins=52), <class 'ptouch.tape.Tape6mm'>: TapeConfig(left_pins=48, print_pins=32, right_pins=48), <class 'ptouch.tape.Tape9mm'>: TapeConfig(left_pins=39, print_pins=50, right_pins=39)}
class ptouch.printers.PTP900Series(connection, use_compression=None, high_resolution=None)[source]

Bases: LabelPrinter

Base class for Brother PT-P900 series printers (560 pins, 360 DPI).

This is the base class for all P900 series printers. Use one of the specific subclasses (PTP900, PTP900W, PTP950NW, PTP910BT) instead.

TOTAL_PINS: int = 560
BYTES_PER_LINE: int = 70
RESOLUTION_DPI: int = 360
RESOLUTION_DPI_HIGH: int = 720
DEFAULT_USE_COMPRESSION: bool = False
PIN_CONFIGS: dict[type[Tape], TapeConfig] = {<class 'ptouch.tape.HeatShrinkTube11_7mm'>: TapeConfig(left_pins=223, print_pins=132, right_pins=205), <class 'ptouch.tape.HeatShrinkTube17_7mm'>: TapeConfig(left_pins=183, print_pins=212, right_pins=165), <class 'ptouch.tape.HeatShrinkTube23_6mm'>: TapeConfig(left_pins=161, print_pins=256, right_pins=143), <class 'ptouch.tape.HeatShrinkTube3_1_11_2mm'>: TapeConfig(left_pins=239, print_pins=100, right_pins=221), <class 'ptouch.tape.HeatShrinkTube3_1_21_0mm'>: TapeConfig(left_pins=169, print_pins=240, right_pins=151), <class 'ptouch.tape.HeatShrinkTube3_1_31_0mm'>: TapeConfig(left_pins=109, print_pins=360, right_pins=91), <class 'ptouch.tape.HeatShrinkTube3_1_5_2mm'>: TapeConfig(left_pins=269, print_pins=40, right_pins=251), <class 'ptouch.tape.HeatShrinkTube3_1_9_0mm'>: TapeConfig(left_pins=245, print_pins=88, right_pins=227), <class 'ptouch.tape.HeatShrinkTube5_8mm'>: TapeConfig(left_pins=261, print_pins=56, right_pins=243), <class 'ptouch.tape.HeatShrinkTube8_8mm'>: TapeConfig(left_pins=241, print_pins=96, right_pins=223), <class 'ptouch.tape.Tape12mm'>: TapeConfig(left_pins=197, print_pins=150, right_pins=213), <class 'ptouch.tape.Tape18mm'>: TapeConfig(left_pins=155, print_pins=234, right_pins=171), <class 'ptouch.tape.Tape24mm'>: TapeConfig(left_pins=112, print_pins=320, right_pins=128), <class 'ptouch.tape.Tape36mm'>: TapeConfig(left_pins=45, print_pins=454, right_pins=61), <class 'ptouch.tape.Tape3_5mm'>: TapeConfig(left_pins=248, print_pins=48, right_pins=264), <class 'ptouch.tape.Tape6mm'>: TapeConfig(left_pins=240, print_pins=64, right_pins=256), <class 'ptouch.tape.Tape9mm'>: TapeConfig(left_pins=219, print_pins=106, right_pins=235)}
class ptouch.printers.PTP900(connection, use_compression=None, high_resolution=None)[source]

Bases: PTP900Series

Brother PT-P900 label printer (USB only, no wireless).

USB_PRODUCT_ID = 8323
class ptouch.printers.PTP900W(connection, use_compression=None, high_resolution=None)[source]

Bases: PTP900Series

Brother PT-P900W label printer (with Wi-Fi).

USB_PRODUCT_ID = 8325
class ptouch.printers.PTP950NW(connection, use_compression=None, high_resolution=None)[source]

Bases: PTP900Series

Brother PT-P950NW label printer (with network connectivity).

USB_PRODUCT_ID = 8326
class ptouch.printers.PTP910BT(connection, use_compression=None, high_resolution=None)[source]

Bases: PTP900Series

Brother PT-P910BT label printer (with Bluetooth).

Note: PT-P910BT does NOT support heat shrink tubes (HSe series).

USB_PRODUCT_ID = 8391
PIN_CONFIGS: dict[type[Tape], TapeConfig] = {<class 'ptouch.tape.Tape12mm'>: TapeConfig(left_pins=197, print_pins=150, right_pins=213), <class 'ptouch.tape.Tape18mm'>: TapeConfig(left_pins=155, print_pins=234, right_pins=171), <class 'ptouch.tape.Tape24mm'>: TapeConfig(left_pins=112, print_pins=320, right_pins=128), <class 'ptouch.tape.Tape36mm'>: TapeConfig(left_pins=45, print_pins=454, right_pins=61), <class 'ptouch.tape.Tape3_5mm'>: TapeConfig(left_pins=248, print_pins=48, right_pins=264), <class 'ptouch.tape.Tape6mm'>: TapeConfig(left_pins=240, print_pins=64, right_pins=256), <class 'ptouch.tape.Tape9mm'>: TapeConfig(left_pins=219, print_pins=106, right_pins=235)}

Supported Printers

PT-E550W Series

  • Class: PTE550W

  • Resolution: 180 DPI (standard), 360 DPI (high)

  • Print head: 128 pins

  • Max tape width: 24mm

  • Features: Auto-cut, Half-cut

PT-P750W Series

  • Class: PTP750W

  • Resolution: 180 DPI (standard), 360 DPI (high)

  • Print head: 128 pins

  • Max tape width: 24mm

  • Features: Auto-cut, Half-cut

PT-P900 Series

All P900 series printers share the same specifications:

  • Classes: PTP900, PTP900W, PTP910BT, PTP950NW

  • Resolution: 360 DPI (standard), 720 DPI (high)

  • Print head: 560 pins

  • Max tape width: 36mm

  • Features: Auto-cut, Half-cut, Page number cuts

See Also