zplCore.comzplCore.com

23ZPL → editable label model

Brings existing ZPL – ERP output, label designer exports, carrier templates – back into the label model: Label.FromZpl returns typed text, barcode, shape, image and RFID items in mm, ^FN fields as data fields and ^DF formats as templates. Every item is rendered on its own against the original and only typed when it prints pixel-identically; otherwise it stays exact raw ZPL. The round trip is measured.

var import = Label.FromZpl(zpl);                         // ImportOptions: Dpi, Unit, Fallback, IncludeImages …
foreach (var l in import.Labels)                         // 0: fidelity 1.0000, 38 typed / 0 raw
    Console.WriteLine($"{l.Index}: fidelity {l.Fidelity:0.0000}, {l.TypedItems} typed / {l.RawItems} raw");
foreach (var w in import.Warnings) Console.WriteLine(w); // Info: Resolution detected as 203 dpi …
File.WriteAllText("label.json", import.Label.ToJson());  // editable label model (JSON schema v3)
string again = import.Label.ToZpl(import.Dpi);           // prints like the original
zplcore import legacy.zpl -o label.json --report [--dpi n] [--unit mm] [--diff diff.png]

Result over the whole corpus (Labelary references, docs, samples, templates): all 318 files round-trip pixel-exact, 98.9 % of the items typed. The resolution is detected from ^MU or the label width; warnings name line and column.

Limits: clock settings (^SO/^ST/^SL), ^CW aliases and ~DB fonts stay raw ZPL; ^MC N, ^IL, ^IS, ^JM are reported as unsupported; a RawZplItem cannot be moved in an editor (the ZPL has absolute positions). Fidelity is measured against the zplCore renderer – for printer accuracy see Accuracy.