zplCore.comzplCore.com

14Export in andere Formate & Sprachen

RasterExport

Gerenderte Bitmaps als PCX, mehrseitiges TIFF (PackBits/CCITT), EPL2-Grafik, Fingerprint, ESC/POS (Rasterbild + Schnitt) und PCL.

LabelLanguageWriter

Das Label-Modell nativ als EPL, Fingerprint, ESC/POS oder PCL – Text und Barcodes bleiben Druckerbefehle.

var renderer = new ZplRenderer();
var results = renderer.Render(File.ReadAllText("labels.zpl"));
SKBitmap bmp = results[0].Bitmap;

File.WriteAllBytes("label.pcx", RasterExport.Pcx(bmp));
File.WriteAllBytes("labels.tif", RasterExport.Tiff(results.Select(r => r.Bitmap), TiffCompression.PackBits));
File.WriteAllBytes("label.epl", RasterExport.Epl(bmp));          // EPL2 GW-Grafik
File.WriteAllBytes("label.fp", RasterExport.Fingerprint(bmp));   // Honeywell/Intermec
File.WriteAllBytes("label.escpos", RasterExport.EscPos(bmp, cut: true));
File.WriteAllBytes("label.pcl", RasterExport.Pcl(bmp, dpi: 300));

// native Befehle aus dem Label-Modell (Text bleibt Text, Barcodes bleiben Barcodes)
string epl = LabelLanguageWriter.ToEpl(label);
string fingerprint = LabelLanguageWriter.ToFingerprint(label);
byte[] escpos = LabelLanguageWriter.ToEscPos(label);
byte[] pcl = LabelLanguageWriter.ToPcl(label);

Online ausprobieren auf zplCloud.com: ZPL zu EPL2 · ZPL zu ESC/POS · ZPL zu PCL

EPL und Fingerprint mit Datensätzen

Mit Datensätzen erzeugt LabelLanguageWriter ein gespeichertes EPL-Formular (FS/FK) mit Variablen und einen Datenblock pro Datensatz bzw. Fingerprint mit Kopienzahl – Masken-Zähler inklusive.

// Label-Modell + Datensätze nativ als EPL2 bzw. Fingerprint (Text und Barcodes bleiben Befehle)
string epl = LabelLanguageWriter.ToEpl(label, parcels, dpi: 203, copies: p => p.Parcels, formName: "VERSAND");
string fp = LabelLanguageWriter.ToFingerprint(label, parcels, dpi: 203, copies: p => p.Parcels);
File.WriteAllText("versand.epl", epl);   // FS/FK-Formular + Variablen, ein Datenblock pro Datensatz
File.WriteAllText("versand.fp", fp);

TIFF, PCL, ESC/POS NV, GIF, HTML, EPS, Spiegeln & DPI-Umrechnung

TIFF mit CCITT G3/G4, LZW, Deflate oder PackBits und 1-Bit, Gray8, RGB oder RGBA; PCL monochrom/grau/farbig mit Modus 0/2/3; ESC/POS mit NV-Grafiken; GIF, SVG, HTML (eingebettet als PNG, GIF oder SVG) und EPS (optional als Umrisse). Ausgaben lassen sich spiegeln (Flip), quer stellen, skalieren, transparent machen und mit DPI-Metadaten versehen. ZplGraphicEncoder wandelt Bilder mit Dithering in ^GF (Hex, ACS, Z64, B64 oder automatisch das kürzeste). ZplRescaler rechnet rohes ZPL zwischen Auflösungen um: Ursprünge, Etikettgröße, Formen, Schriften, Feldblöcke, ^BY, 2D-Modulgrößen und ^GF-Grafiken.

var s = new ZplRenderSettings
{
    OutputFormat = ZplOutputFormat.Tiff,
    TiffCompression = TiffCompression.CcittGroup4,   // None, CcittGroup3, Lzw, Deflate, PackBits
    TiffPixelFormat = TiffPixelFormat.BlackWhite1,   // Gray8, Rgb24, Rgba32
    Flip = ZplFlip.X, PaperOrientation = ZplPaperOrientation.Landscape,
    WriteDpiMetadata = true,
}.WithLabelSizeMm(100, 60);
byte[] tiff = new ZplRenderer(s).ProcessCommands(zpl)[0];

s.OutputFormat = ZplOutputFormat.Pcl;  s.PclColorMode = PclColorMode.Grayscale; s.PclCompression = PclCompression.DeltaRow;
s.OutputFormat = ZplOutputFormat.Eps;  s.EpsTextAsOutlines = true;
s.OutputFormat = ZplOutputFormat.Html; s.HtmlImageFormat = HtmlLabelImageFormat.Svg;
s.OutputFormat = ZplOutputFormat.Gif;

// ESC/POS: Grafik einmal im NV-Speicher ablegen, danach nur noch aufrufen
byte[] define = EscPosNv.DefineGraphic(photo, "G1"), print = EscPosNv.PrintGraphic("G1");

// Bild → ^GF mit Dithering und kürzester Kodierung
string gf = ZplGraphicEncoder.ToZpl(photo, GraphicCompression.Auto, DitherMode.FloydSteinberg, x: 20, y: 20);

// ZPL von 203 auf 300 dpi umrechnen (Koordinaten, Schriften, ^BY, ^GF …)
string zpl300 = ZplRescaler.Rescale(zpl, 203, 300);

Online ausprobieren auf zplCloud.com: Bild zu ZPL · ZPL-DPI-Konverter

Mehr dazu auf zplCloud.com: Guide: Grafiken in ZPL (^GF)