zpl.tools
Media and sensors

^MN - Media Tracking

Tells the printer whether the stock is continuous or has a gap, web or black mark between labels.

^MN tells the printer how one label separates from the next. The options are a gap or web it sees through, a black mark it sees by reflection, or nothing at all. The setting decides whether the printer measures each label or takes its length from ^LL. A mismatch between ^MN and the loaded stock is the usual reason print drifts along the roll.

Syntax

^MNa,b

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 MnCommand, and nothing reads it. On a printer this setting decides where one label ends. With gap or mark tracking the sensor finds the break; with continuous media (^MNN) the length comes from ^LL. Neither route reaches the output. The parser gives ^LL no effect on purpose, and the page size comes from the API request dimensions. 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

How the printer finds the boundary between one label and the next. N and V are the continuous cases, with no boundary to find.

Invalid value
not possible — any value is accepted. The parser stores this argument as a free string, unchecked against the accepted letters. Nothing reads it.
Test coverage
No documented value is exercised by a test (N, V, W, Y, M, A).
N
Continuous media
V
Variable-length continuous media
W
Non-continuous web-sensing media
Y
Non-continuous web-sensing media, same as W
M
Non-continuous mark-sensing media
A
Auto-detect the media type during calibration
bMark offsetoptional · dotsnot honoured by zpl.tools

How far the black mark is from the actual label break. A negative value puts the mark before the break.

Default
0
Accepted range
-120 to 283 dots
Invalid value
clamped to the nearest allowed value. The parser reads the slot as a signed offset and clamps it. Measured on live Labelary 2026-08-19: ^MNY,-75 is silent, ^MNY,-1000 answers Value -1000 is less than minimum value -120; used -120 instead and ^MNY,9999 answers Value 9999 is greater than maximum value 283; used 283 instead. The floor is -120, not the guide's -80. Nothing reads the field.
Test coverage
No test at the minimum, maximum or one step outside the range. The invalid-value rule is not pinned by a test.

Behavior

The choice splits in two. With W, Y or M the printer looks for a physical break — a web, notch, perforation or mark — and each label ends where the sensor says it does. With N no break exists, so the length comes from ^LL instead. ^JS selects the sensor: transmissive for a web, reflective for a mark.

The parser reads the mark offset with an unsigned helper that passes over every leading non-digit, including the minus sign. ^MNM,-75 therefore stores as 75, with no diagnostic. Nothing reads the value, so the damage is invisible today. This page records it because the renderer drops the sign silently rather than rejects the value.

The renderer validates neither argument against the accepted letters, and neither reaches the image. The page size comes from the dimensions in the API request. The renderer parses ^LL and then ignores it, so both routes through this command end in the same place.

Differences from the specification

Labelary against the ZPL II guide

Where Labelary — our compatibility target — behaves differently from the printed specification.

  • The guide (45541L-004, page 228) gives the format as ^MNa, with one argument. Labelary and later firmware document the mark offset b, and the 2006 edition does not. — not pinned by a test
  • The guide accepts N, Y, W and M. Labelary adds V for variable-length continuous media, and A for auto-detection. — not pinned by a test

zpl.tools against the ZPL II guide

Where our renderer behaves differently from the specification.

  • The parser puts both arguments into MnCommand. Nothing reads them. — not pinned by a test
  • The parser reads the mark offset as an unsigned value. It discards the sign of a negative offset, and reports no invalid argument. — not pinned by a test

Example

Web-sensing stock, declared ahead of the label:

^XA
^MNW
^FO50,50^A0N,40,40^FDGap-sensed stock^FS
^XZ

Open in viewer

A black mark 75 dots before the label break.

^XA
^MNM,-75
^FO50,50^A0N,40,40^FDMark 75 dots early^FS
^XZ

Open in viewer