zplCore.comzplCore.com

25Vector-Lift: PDF/SVG → native ZPL

Converts PDF pages (carrier and ERP labels) and SVGs into native ZPL instead of one large ^GF raster: text becomes ^A0 fields, barcodes are located, decoded and regenerated with the matching ^B command, lines, boxes, circles and ellipses become ^GB/^GD/^GC/^GE; only the rest stays a graphic. Every conversion is measured: the original and the generated ZPL are rendered and compared pixel by pixel. Separate package ZplCore.VectorLift (PDFium), so the core stays free of PDF dependencies.

Try it online on zplCloud.com: PDF/SVG to native ZPL

// using ZplCore.VectorLift;

var result = VectorLift.ConvertSvg(svg, new VectorLiftOptions { Dpi = 203 });   // or Convert(pdfBytes, …)
File.WriteAllText("label.zpl", result.Zpl);        // ^A0 text, native ^BC/^BQ …, ^GB/^GC, ^GF only for the rest
Console.WriteLine(result.ToReport());              // one entry per element + measured fidelity + sizes
Console.WriteLine($"{result.Fidelity:P1} Treue, {result.ZplBytes} statt {result.RasterZplBytes} Bytes als ^GF");
var label = result.ToLabel();                      // continue as an editable label model
zplcore lift label.pdf -o label.zpl --report [--page n|all] [--dpi 203] [--crop] [--diff diff.png] [--min-fidelity 0.95]
zplcore lift label.svg -o label.zpl --json report.json

799x400 dots @ 203 dpi, fidelity 0.9785, native ink 97.8 %, 370 bytes vs 4,140 bytes ^GF raster (8.9%)
  Native       Barcode  @60,200 336x90 CODE_128 "SN20260815" score 1.000 data ok

SVG original

SVG label with title, storage location, rule, Code 128, serial number and QC stamp

Generated ZPL, rendered

The same label from native ZPL: text in font 0, Code 128 as ^BC, frame, rule and circle as ZPL shapes

Source: lift-label.svg · Result: lift-label.zpl

Limits: text prints in font 0 unless you supply a TrueType font whose licence flags permit embedding (~DU + ^A@); fonts embedded in PDFs are never extracted. Text without a text layer (drawn as outlines) stays graphic – no OCR. Clip paths count as rectangles; QR/Aztec masks and versions are the encoder's choice (data identical, pattern may differ). The SVG reader has no CSS style sheets, filters, masks, gradients, scripts or external resources. PDFium is not thread-safe (calls are serialised); typically 1–4 s per 4 × 6″ label.