zpl.tools
Media and sensors

^MT - Media Type

Declares whether the stock is direct thermal or needs a thermal-transfer ribbon.

^MT says which of the two imaging methods the loaded stock uses. Direct thermal paper darkens under the printhead, and thermal transfer stock needs a ribbon to carry ink onto it. It changes what the printer expects to find, not what it draws, so it declares hardware rather than format.

Syntax

^MTa

Support

Recognised, deliberately skippedparsed: full · state: none · rendered: none

Accepted and skipped, because it configures the printer rather than the label. It cannot change the rendered output, and Labelary skips it too.

The parser stores this command as MtCommand, and nothing reads it. The choice decides whether the printer expects a ribbon, and the renderer has neither ribbon nor stock. The parser reads it, so the renderer reports no unsupported-command warning, unlike the unparsed media commands below. — not pinned by a test

Labelary renders this command.

Parameters

aMedia typerequired · one of a setnot honoured by zpl.tools

Which imaging method the stock uses. An incorrect value on a printer gives a blank or ribbon-out label. In a render it changes nothing.

Invalid value
not possible — any value is accepted. The parser takes the whole remainder of the command instead of one comma-delimited argument, so ^MTD,X gives the value D,X. The parser accepts any word, and its own test asserts that ^MTTHERMAL parses. Nothing reads the result.
Test coverage
No documented value is exercised by a test (D, T).
D
Direct thermal media, no ribbon
T
Thermal transfer media, ribbon required

Behavior

A printer shows the wrong value at once, in one of two ways:

  • T with no ribbon loaded raises a ribbon-out error.
  • D with a ribbon fitted wastes the ribbon, and the label prints from the paper's own coating.

The choice also decides whether ^JW, which sets ribbon tension, has anything to act on.

The guide is explicit that a value must be entered, or the printer ignores the command.

The parser here is looser. It takes the whole remainder of the command rather than one comma-delimited argument, so ^MTD,X gives the value D,X, and ^MTTHERMAL parses as THERMAL. The parser's own unit test asserts exactly that. Nothing then reads the value, so the renderer neither corrects nor reports an invalid media type.

Tested behavior

Differences from the specification

zpl.tools against the ZPL II guide

Where our renderer behaves differently from the specification.

  • The parser puts the argument into MtCommand. Nothing reads it. — not pinned by a test
  • The parser reads the rest of ^MT with remaining() instead of one argument. It folds trailing text into the value and does not reject it. — not pinned by a test

Example

Thermal transfer stock declared in front of the label.

^XA
^MTT
^FO50,50^A0N,40,40^FDRibbon required^FS
^XZ

Open in viewer

  • ^JW Set Ribbon TensionThis command sets the thermal-transfer ribbon tension.
  • ^MN Media TrackingThis command tells the printer whether the stock is continuous, or has a gap, web or black mark between labels.
  • ^MF Media FeedThis command sets what the printer does with the media at power-up and when the printhead closes.
  • ~SD Set DarknessSets the base print darkness level.