17Compliance pre-check: rule packs as code
Checks labels against public requirements before they print: ZplCompliance.Check renders the ZPL and measures the printed geometry – X-dimension in mm, bar height, quiet zones, human-readable text, text height, overlaps, cut-off symbols, GS1 AIs with check digits and combination rules, Digital Link syntax, MaxiCode carrier message. 72 rules in packs, each with a stable id, severity and citation.
Try it online on zplCloud.com: Label Compliance Check
More on zplCloud.com: Guide: Why Amazon rejects labels · Template: SSCC pallet label (GS1-128) · Template: UDI/HIBC device label
Pack (--pack) | Content | Sources |
|---|---|---|
gs1-logistic | SSCC in GS1-128, X-dimension ≥ 0.495 mm, bar height, quiet zones, human-readable text ≥ 3 mm, AI formats and combinations | GS1 General Specifications 26.0, Logistic Label Guideline 1.3 |
sunrise | Sunrise 2027: GTIN in a GS1 DataMatrix or a QR Code with GS1 Digital Link next to the EAN/UPC, module size, URI syntax | GenSpecs 26.0, Digital Link URI Syntax 1.7.0 |
amazon-fba, ups, fedex, dhl-paket | sizes, required barcodes, quiet zones, MaxiCode carrier message, 1Z check digit | public carrier documentation (partly marked "advisory") |
udi | UDI-DI (01), production identifiers, date rules, permitted carriers | 21 CFR 801, EU MDR Annex VI, GenSpecs 26.0 |
rfid | does ^RF write the EPC of the printed SSCC/GTIN? (see RFID Studio) | GS1 EPC TDS 2.3 |
// using ZplCore.Compliance;
var report = ZplCompliance.Check(zpl, CompliancePacks.Gs1LogisticLabel | CompliancePacks.Sunrise2027,
new ComplianceOptions { Dpi = 203 }); // ZPL carries no resolution: set the printer's dpi
foreach (var f in report.Findings)
Console.WriteLine(f); // label 1: ZPL3104 error (16:1): ^BC: X-dimension 0.25 mm … below the minimum 0.495 mm
File.WriteAllText("labels.sarif", report.ToSarif("labels/pallet.zpl")); // GitHub Code Scanning
string json = report.ToJson();
List<byte[]> pngs = ZplCompliance.RenderAnnotated(zpl, report); // frames + rule ids on the label
zplcore comply pallet.zpl --pack gs1-logistic,sunrise --dpi 203 [--format text|json|sarif] [--annotate out.png]
zplcore comply --list-rules --pack all # every rule with id, severity and source
pallet.zpl:16:1: error ZPL3104: label 1 ^BC: X-dimension 0.25 mm (2 dot(s) at 203 dpi) is below the minimum
0.495 mm for logistic units … [GS1 General Specifications 26.0 §5.12.3.5 Table 5-51]
fix: Use ^BY4 or wider at 203 dpi.
1 label(s) at 203 dpi, packs gs1-logistic GenSpecs 26.0 / LLG 1.3: 4 error(s), 0 warning(s), 0 info(s).
Pre-check only, not a certification.
Annotated label

The pallet label of samples/compliance/gs1-logistic-sscc.zpl, but with ^BY2: both GS1-128 are too narrow and their text is too small.
Outputs & custom rules
- Findings with rule id, pack, severity, command, line/column, bounding box in dots, source and suggested fix
- JSON, text and SARIF 2.1.0 for GitHub code scanning (rules with
helpUri) RenderAnnotated: frames and rule ids drawn on the label- Custom rules with
ComplianceRule.Create(…), custom packs withComplianceRulePack; adapt built-in packs with.With(rule)/.Without("ZPL3117") ComplianceOptions:Dpi, label size without^PW/^LL,FieldValues,DisabledRules,SeverityOverrides,MinimumSeverity
Limits: ZPL carries no resolution – every millimetre rule applies to the given Dpi. Not covered: print quality grades (contrast, defects), label placement on the unit, HIBCC/ICCBBA UDIs, DHL Express and the FedEx label certification. Values from non-public sources are marked "advisory".

