zplCore.comzplCore.com

ZplFormatter

public static class ZplFormatter

Pretty-prints or minifies raw ZPL (a shortcut for ZplDocument.Parse + ZplDocument.ToZpl). The output renders pixel-identically to the input: field data, ^FH escapes and graphic payloads are copied unchanged, and no line break is ever placed inside or directly after field data.

Input whose output would not parse back to the same commands (only possible with exotic ^CC/^CT/^CD combinations) is returned unchanged. Text outside of commands (e.g. stray characters before ^XA) is ignored by printers and dropped.

Try it online on zplCloud.com: ZPL Formatter

Methods

Method SignatureReturnsDescription
static # Format(string zpl, ZplOutputOptions? options = default)stringFormats zpl; default: pretty-printed, 2 spaces indentation.
static # Minify(string zpl, bool keepComments = false)stringRemoves all whitespace between commands and the ^FX comments (one label per line).