zplCore.comzplCore.com
class85 members

ZplRenderSettings

public sealed class ZplRenderSettings

Settings for rendering ZPL to images. All sizes in printer dots unless noted.

Constructors

SignatureDescription
# ZplRenderSettings()

Properties

PropertyTypeDescription
AntiAlias { get; set; }boolAnti-aliased text and shapes. Off gives pure 1-bit output like a thermal printer.
BackgroundColor { get; set; }SKColorLabel (paper) color.
BackgroundImage { get; set; }SKBitmapOptional image drawn below the label content (e.g. a pre-printed form).
Clock { get; set; }Func<DateTime>Printer clock for ^FC fields (override for deterministic output). Also the PDF creation/modification date, which is always written in UTC (a DateTimeKind.Unspecified value counts as local time).
CompactPng { get; set; }boolWrite black/white labels as 8-bit grayscale (anti-aliased) or 1-bit PNG (ZplRenderSettings.AntiAlias off) instead of 32-bit RGBA — much faster and smaller. Coloured output always uses RGBA.
CutMarkColor { get; set; }SKColorColour of the cut line and scissors (default red #D32F2F).
CutMarks { get; set; }boolDraws cut markers into preview output (opt-in, default off: output stays byte-identical). Every label gets a light grey strip below its bottom edge (the trailing edge in feed direction); a label after which the printer cuts (ZplRenderer.LastCutPlan) shows a dashed line with a scissors glyph in that strip, a partial kiosk cut leaves a gap in the line, a ^MMD label waiting for ~JK shows the marker in grey, and a ^PQ pause is shown as a pause sign at the right end. Applies to PNG, JPEG, WebP, BMP, GIF, PDF, SVG, HTML and EPS (also ZplRenderer.RenderSvg and the bitmaps of ZplRenderer.Render), never to printer languages or 1-bit TIFF/PCX.
CutterInstalled { get; set; }boolThe printer has a cutter (default true). When false, cutter, delayed cut and kiosk mode cut nothing and the cut plan reports ZplCutReason.NoCutterInstalled (the virtual printer raises a cutter fault).
DecodedWithPrinterCodePages { get; set; }boolThe ZPL string was decoded from printer bytes with ZplTextEncoding (code page of the active ^CI). Barcodes and the other non-text fields then encode those bytes again, like a printer; text fields print the decoded characters. ZplRenderer.ProcessCommands and the virtual printer do this on their own; set it when you decode with ZplTextEncoding yourself.
DefaultCodePage { get; set; }intCode page of field data before the first ^CI (Zebra power-up value ^CI0: code page 850). 1252, 1250, 1251, 1253, 1254 and 1255 select the matching ^CI (27, 31, 33–36) as power-up value, 65001 ^CI28.
DotsPerMm { get; }double
Dpi { get; set; }intPrint resolution: 152, 203, 300 or 600 dpi.
DrawRfid { get; set; }boolDraw the data of ^RF (RFID) fields as a small box on the label.
EpsTextAsOutlines { get; set; }boolEPS output as vector outlines (text, barcodes and graphics traced to filled shapes) instead of an image.
FieldValues { get; set; }IReadOnlyDictionary<int, string>Values for ^FN fields, keyed by field number (^FN1 → key 1). A value replaces the data of every field with that number in every label of the render call: fields of the label itself, fields of formats recalled with ^XF (it wins over the ^XF data block and over a ^FD default). ^FH, ^FC and ^SN/^SF still apply to the value. Keys without a matching ^FN field are reported as diagnostic ZplDiagnosticCodes.InvalidFieldValueKey on the first label. Null or empty = no override (default).
FingerprintDisableRun { get; set; }boolFingerprint output without the trailing print statement (PF), e.g. to merge into own programs.
Flip { get; set; }ZplFlipMirror the final image (applied after rendering, before encoding).
FontProvider { get; set; }Func<string, byte[]>Resolves fonts that a label references but that were never registered or downloaded (e.g. "E:ARIAL.TTF" in ^A@/^CW): return the TTF/OTF bytes, or null if unknown. Called at most once per font name per FontManager. Unresolved ^A@ fonts print with font A, like a Zebra printer.
ForceLabelHeight { get; set; }bool
ForceLabelWidth { get; set; }bool
GrfCompression { get; set; }GraphicCompression^GF data encoding for ZplOutputFormat.Grf output.
GrfDither { get; set; }DitherMode1-bit conversion for ZplOutputFormat.Grf output.
HtmlImageFormat { get; set; }HtmlLabelImageFormatImage embedded in ZplOutputFormat.Html output.
ImageScaleX { get; set; }doubleHorizontal scale factor of encoded images (1 = printer dots). DPI metadata is scaled accordingly.
ImageScaleY { get; set; }doubleVertical scale factor of encoded images.
InkColor { get; set; }SKColorInk / ribbon color.
InvertColors { get; set; }boolSwap ink and background (negative output).
LabelContour { get; set; }ZplLabelContourOutline of the label stock in previews: ZplLabelContour.Ellipse tints the area outside the ellipse inscribed in the label and draws the ellipse as a thin grey line over the content (round labels). Only for PNG, JPEG, WebP, BMP, GIF, PDF, SVG, HTML and EPS output, like ZplRenderSettings.RfidIndicator.
LabelGap { get; set; }int
LabelHeight { get; set; }intLabel height in dots (default 6 in). ^LL overrides unless ZplRenderSettings.ForceLabelHeight.
LabelLengthContinuousOnly { get; set; }boolApply ^LL only on continuous media (^MNN), like a gap/mark-sensing printer: with web or mark sensing the printer measures the label length itself and ^LL does not shorten the printed area. Default off (^LL always sets the image height).
LabelWidth { get; set; }intLabel width in dots (default 4 in). ^PW overrides unless ZplRenderSettings.ForceLabelWidth.
MaxFieldDataLength { get; set; }intMaximum length of one field's data (^FD/^FV, after ^FH); longer data is truncated (default 1 M chars). 0 = unlimited.
MaxGraphicBytes { get; set; }intMaximum decoded size of one graphic (^GF, ~DG, ~DY, ~DU, Z64 inflate output) in bytes (default 32 MB). Larger graphics are ignored (^GF records a warning). 0 = unlimited.
MaxLabelDots { get; set; }longMaximum label area in dots (width × height) after ^PW/^LL/settings. Larger labels are clamped (height first, then width) so malicious input cannot allocate gigabytes. Default 64 M dots (e.g. 8000 × 8000, a 256 MB RGBA bitmap). 0 = unlimited.
MaxLabelSide { get; set; }intMaximum width or height of a label in dots (default 32000, the ZPL maximum for ^PW/^LL). 0 = unlimited.
MaxLabels { get; set; }intMaximum number of labels produced by one Render/ProcessCommands call (default 100000); further formats are skipped.
MaxQuantity { get; set; }intUpper bound for ^PQ copies per format (default 10000). Larger quantities are clamped.
OutputFormat { get; set; }ZplOutputFormat
OutputRotation { get; set; }ZplRotation
PaperHeight { get; set; }int
PaperMargin { get; set; }int
PaperOrientation { get; set; }ZplPaperOrientationPage orientation of the output (applied to the final image / PDF sheet).
PaperWidth { get; set; }intPDF sheet layout: paper size in dots (e.g. A4 at 203 dpi = 1680 x 2376). 0 = one page per label in label size. Labels are placed left-to-right, top-to-bottom with ZplRenderSettings.PaperMargin and ZplRenderSettings.LabelGap.
PclColorMode { get; set; }PclColorModePCL raster mode.
PclCompression { get; set; }PclCompressionPCL raster compression (mode 0, 2 or 3).
PdfAuthor { get; set; }string
PdfCreator { get; set; }string
PdfImageQuality { get; set; }intImage quality of raster PDF pages (ZplRenderSettings.PdfVector = false): 101 = lossless (default), 1–100 = JPEG of that quality – smaller for labels with photos or grey images; plain black-and-white labels are usually smaller lossless. Images inside a vector PDF stay lossless.
PdfKeywords { get; set; }string
PdfProducer { get; set; }stringPDF Producer metadata.
PdfSubject { get; set; }string
PdfTitle { get; set; }string
PdfVector { get; set; }boolZplOutputFormat.Pdf with vector content (shapes, barcodes, glyph outlines) instead of one image per label: crisp at any zoom. On by default; false embeds one lossless image per label at the label dpi. Field reverse (^FR/^LR) areas on mixed backgrounds and ^GF graphics are embedded as lossless images.
PngCompression { get; set; }PngCompressionPNG zlib level (speed vs. size).
Quality { get; set; }intJPEG/WebP quality 0–100.
RenderOutputIndexes { get; set; }int[]Only output these labels (0-based, in print order incl. ^PQ copies); null = all.
RfidIndicator { get; set; }ZplRfidIndicatorMarks labels with RFID commands (^RF, ^WT, ^WF, ^RQ) in previews: ZplRfidIndicator.Watermark (default) draws a grey RFID tag pictogram (about 0.86", centred, behind all label content, turned with ^PO I) like common ZPL preview tools. Only for PNG, JPEG, WebP, BMP, GIF, PDF, SVG, HTML and EPS output; never in printer languages (GRF, EPL, PCL, Fingerprint, ESC/POS) or the 1-bit TIFF/PCX files.
RfidIndicatorColor { get; set; }SKColorColour of the RFID watermark (default light grey #C0C0C0).
RfidIndicatorOpacity { get; set; }floatOpacity of the RFID watermark, 0..1 (default 1).
SvgElementAttributes { get; set; }boolVector SVG: each field group carries data-cmd, data-offset and data-length (source span in the ZPL) for hit testing.
SvgMode { get; set; }ZplSvgModeHow ZplOutputFormat.Svg is produced: ZplSvgMode.Vector (default) writes shapes, barcode modules and glyph outlines as vector paths; ZplSvgMode.TracedRaster traces the rendered bitmap into rectangles (output before version 2); ZplSvgMode.EmbeddedRaster embeds the bitmap as PNG.
SvgSelectableText { get; set; }boolVector SVG: additionally write an invisible <text> over every single-line text field so the text can be selected/searched in a browser (the visible text stays glyph outlines).
ThumbnailSize { get; set; }intWhen > 0, encoded images are scaled down so the longer edge has this many pixels.
TiffCompression { get; set; }TiffCompressionTIFF compression for ZplOutputFormat.Tiff.
TiffPixelFormat { get; set; }TiffPixelFormatTIFF sample format (CCITT compression requires 1 bit).
TraceElements { get; set; }boolCollect ZplRenderedElement information while rendering.
TransparentBackground { get; set; }boolPaper becomes transparent in PNG/WebP/GIF/TIFF output (black/white labels keep anti-aliasing as alpha).
UseSystemFonts { get; set; }boolAlso resolve ^A@ font names as installed system font families (e.g. "Arial", "Arial Bold") when they are neither registered nor supplied by ZplRenderSettings.FontProvider; unknown families then use the built-in sans font instead of font A (warning ZPL1201). Off by default (printer behaviour); the label model (Label) turns it on.
WatermarkImage { get; set; }SKBitmapImage drawn over every label (e.g. "MUSTER"/"PREVIEW"), centered and scaled to fit.
WatermarkOpacity { get; set; }floatWatermark opacity 0–1.
WriteDpiMetadata { get; set; }boolWrite the resolution into PNG (pHYs) and JPEG (JFIF density) files (off by default so existing output stays byte-identical).

Fields & Constants

FieldTypeDescription
const MaxImageBytes = 52428800intLargest encoded image accepted by the LoadImage* helpers (default 50 MB).
const MaxImageSide = 20000intLargest width/height in pixels accepted by the LoadImage* helpers.

Methods

Method SignatureReturnsDescription
static # FromJson(string json)ZplRenderSettings
static # LoadImage(string source)SKBitmapLoads an image from a data URI (data:image/png;base64,...), an existing file path or a plain base64 string (for ZplRenderSettings.BackgroundImage / ZplRenderSettings.WatermarkImage). URLs are not fetched here (no hidden network access); use ZplRenderSettings.LoadImageFromUrlAsync. Throws ArgumentException: Unsupported, oversized or undecodable data, or a URL.
static # LoadImageFromBase64(string base64)SKBitmapDecodes a base64 encoded image.
static # LoadImageFromFile(string path)SKBitmapLoads an image file (at most ZplRenderSettings.MaxImageBytes).
static # LoadImageFromUrlAsync(Uri url, HttpClient? http = default, CancellationToken ct = default)Task<SKBitmap>Downloads and decodes an image (size-capped; pass your own http to control proxies, timeouts and allowed hosts).
# ToJson()stringSaves all settings (images as base64 PNG, colors as #AARRGGBB).
# WithBackgroundImage(string source)ZplRenderSettingsSets ZplRenderSettings.BackgroundImage from a file, data URI or base64 string (see ZplRenderSettings.LoadImage).
# WithLabelSizeInches(double width, double height)ZplRenderSettingsConvenience: sets label size from inches.
# WithLabelSizeMm(double widthMm, double heightMm)ZplRenderSettingsConvenience: sets label size from millimeters.
# WithWatermarkImage(string source, float opacity = 0.25)ZplRenderSettingsSets ZplRenderSettings.WatermarkImage from a file, data URI or base64 string (see ZplRenderSettings.LoadImage).