zplCore.comzplCore.com
class12 members

PrinterProfiles

public static class PrinterProfiles

The printer profile catalogue: built-in profiles (embedded JSON, one file per family, schema PrinterProfiles.SchemaJson), custom profiles added with PrinterProfiles.Register / PrinterProfiles.Load, lookup by id or alias and detection from printer responses (PrinterProfiles.Detect).

Properties

PropertyTypeDescription
static All { get; }IReadOnlyList<PrinterProfile>Built-in and registered profiles (a registered profile with the id of a built-in one replaces it).
static BuiltIn { get; }IReadOnlyList<PrinterProfile>Profiles shipped with zplCore, in catalogue order.
static Generic { get; }PrinterProfileThe generic profile (zplCore defaults, no hardware limits that are not assumptions).
static SchemaJson { get; }stringJSON schema (draft 2020-12) of a profile family file.

Methods

Method SignatureReturnsDescription
static # Detect(string response)PrinterDetectionParses what a printer answered and picks the matching profile. Accepts (also mixed, one per line): the ~HI answer ("ZD230,V89.21.46Z,8,4096KB," with or without STX/ETX), ~HQPP ("MDL: GX420t"), ~HQSN, an IEEE 1284 device id (usb.device.device_id_string), SGD lines "name : value" (allcv) or a JSON object of SGD names and values (device.product_name, appl.name, head.resolution.in_dpi, device.languages, ezpl.print_width, device.unique_id, device.host_identification, usb.device.product_string).
static # Find(string idOrAlias)PrinterProfileFinds a profile by id or alias (case-insensitive; "ZD421-203", "zd421d-203" and "ZD421d 203" all match); null if none.
static # Get(string idOrAlias)PrinterProfileLike PrinterProfiles.Find but throws KeyNotFoundException with the list of ids.
static # Load(string json)IReadOnlyList<PrinterProfile>Parses a profile family document (see PrinterProfiles.SchemaJson) into one profile per variant. Throws FormatException with all problems found: unknown fields, values of the wrong type, verified or derived values without a source, source ids that the document does not define.
static # LoadDirectory(string directory)IReadOnlyList<PrinterProfile>Loads every *.json profile family file of a directory (not recursive).
static # Register(PrinterProfile profile)voidAdds or replaces a custom profile (process-wide).
static # ToJson(PrinterProfile profile, bool indented = true)stringThe profile as a flat JSON object (facts with status, value, sources, quote, note; sources with URLs).
static # Unregister(string id)boolRemoves a custom profile; built-in profiles cannot be removed.