Skip to content

Interface: D1Media

D1 tape media descriptor — minimum shape needed by the encoder.

Driver-side media types (LabelManager's LabelManagerMedia, LabelWriter's tape media) extend this with family-specific narrowing or additional UX fields. The encoder itself only reads printableDots, text, and background.

  • printableDots — cartridge-printable raster width in dots. Encoder uses this to size ESC D N (bytes-per-line) when present.
  • text / background — symbolic colour names used by tapeTypeFor() to derive the ESC C n palette selector.

Catalogued entries (D1_MEDIA from media.generated.ts) populate every field; user-constructed media for the encoder may pass a subset (any field absent falls back to engine.headDots / tapeTypeFor defaults).

Extends

Properties

PropertyModifierTypeDescriptionInherited from
background?publicstringSubstrate colour, named.-
bytesPerLine?publicnumberBytes-per-line (ceil(printableDots / 8)). Convenience mirror of printableDots.-
category?public| "address" | "shipping" | "file-folder" | "multi-purpose" | "name-badge" | "barcode" | "price-tag" | "continuous" | "cartridge" | "tape" | "die-cut"Coarse category for grouping in docs and UI. Driver-extensible; common values listed for cross-driver consistency.MediaDescriptor.category
cornerRadiusMm?publicnumberCorner radius (mm) of die-cut labels with rounded corners. Only meaningful for die-cut media. Undefined or 0 = sharp corners. For round labels, set this to widthMm / 2 so the rounded rectangle degenerates to a circle.MediaDescriptor.cornerRadiusMm
defaultOrientation?public"horizontal" | "vertical"Hint for how the user is expected to author content for this media. Drives the auto-rotate decision in print(): - 'horizontal' — long axis horizontal when reading (landscape). Driver rotates 90° in the family-specific direction when input matches landscape dimensions. Examples: 89×28 mm address labels, 12 mm narrow tape with a name on it. - 'vertical' — long axis vertical when reading (portrait). Driver passes through. - undefined — driver passes through. Recommended for continuous wide tape (62 mm) where users may go either way.MediaDescriptor.defaultOrientation
heightMm?publicnumberPhysical height/length in mm. - Undefined = continuous (variable length; printer cuts to content). - A number = fixed length (die-cut labels, tape segments).MediaDescriptor.heightMm
idpublicstring | numberUnique identifier within the driver family.MediaDescriptor.id
material?publicD1MaterialD1 substrate family (UX hint).-
namepublicstringHuman-readable name, e.g. "62mm continuous" or "DK-22251".MediaDescriptor.name
palette?publicreadonly PaletteEntry[]Inks this media supports, beyond the implicit white substrate. - Undefined = single-colour black-on-white. Driver renders via renderImage (luminance threshold + optional dither). - Defined = multi-plane media. Driver renders via renderMultiPlaneImage with this palette. For DK-22251 (the only multi-ink media we ship today): [{ name: 'black', rgb: [0, 0, 0] }, { name: 'red', rgb: [255, 0, 0] }]MediaDescriptor.palette
printableDots?publicnumberCartridge-printable raster width in dots.-
printMargins?public{ bottomMm: number; leftMm: number; rightMm: number; topMm: number; }Insets (mm) inside the media bounds where the printer may clip a design (paper-feed tolerance, head edges, die-cut slack). Informational — for label designers and previews. Drivers do not enforce these; protocol-level margins (head pin offsets, head-dot fitting) are handled separately by family-specific fields. When present, all four edges are required (pass 0 where there is no margin). Omit the whole field when the entire media area is safe to design within.MediaDescriptor.printMargins
printMargins.bottomMmreadonlynumber--
printMargins.leftMmreadonlynumber--
printMargins.rightMmreadonlynumber--
printMargins.topMmreadonlynumber--
skus?publicreadonly string[]Vendor SKUs for this media — e.g. Dymo '30321' / 'S0722400', Brother 'DK-22251'. Mixed formats allowed; the registry does no validation. Used by docs (per-device "supported media" table) and by UI consumers that let users search by SKU.MediaDescriptor.skus
tapeWidthMm?publicnumberTape width in mm — informational; the encoder reads printableDots.-
targetModels?publicreadonly string[]Devices this media is compatible with. Driver-defined string set; matched against PrintEngine.mediaCompatibility. Examples: ['standard'] (paper roll fits 672-dot heads), ['4xl', '5xl'] (wide-head only), ['duo'] (D1 cartridges). Omit = fits every device in the family.MediaDescriptor.targetModels
text?publicstringPrinted ink colour, named (the only ink the cassette carries).-
typepublicstringMedia type classification — driver-specific string values. Common values: 'continuous', 'die-cut', 'tape'. Drivers may define additional values as needed.MediaDescriptor.type
widthMmpublicnumberPhysical width in mm.MediaDescriptor.widthMm