All Projects → BinaryKits → Zplutility

BinaryKits / Zplutility

Licence: mit
ZPL Utility, a .net tool library helping to generate ZPL string

Labels

Projects that are alternatives of or similar to Zplutility

Invite Contributors
automatically invite authors of merged pull requests to your organization
Stars: ✭ 30 (-50%)
Mutual labels:  utility
Wtf
Whitespace Total Fixer
Stars: ✭ 40 (-33.33%)
Mutual labels:  utility
C Utils
Tiny, modular, drop-in, library of some most commonly used utility methods for C (embedded) applications. Intended to be used as a git-submodule inside your projects to kickstart development. See https://c-utils.gotomain.io for more details.
Stars: ✭ 47 (-21.67%)
Mutual labels:  utility
Unidump
hexdump(1) for Unicode data
Stars: ✭ 31 (-48.33%)
Mutual labels:  utility
Flutter mono kit
A collection of convenient widgets and utils made by mono.
Stars: ✭ 39 (-35%)
Mutual labels:  utility
Ngx Infinite Scroll
Infinite Scroll Directive for Angular
Stars: ✭ 1,024 (+1606.67%)
Mutual labels:  utility
Text Minimap
Generate text minimap/preview using Braille Patterns
Stars: ✭ 21 (-65%)
Mutual labels:  utility
Cameo
CMIO DAL plugin explorer
Stars: ✭ 59 (-1.67%)
Mutual labels:  utility
Remixbot
A multifunctional Discord bot in development that allows you to easily control your discord server.
Stars: ✭ 39 (-35%)
Mutual labels:  utility
Uhubctl
uhubctl - USB hub per-port power control
Stars: ✭ 1,036 (+1626.67%)
Mutual labels:  utility
Itt
Iteration tools.
Stars: ✭ 32 (-46.67%)
Mutual labels:  utility
Chmap
The Windows `charmap` utility for Linux
Stars: ✭ 39 (-35%)
Mutual labels:  utility
Potato Library
Easy to use Utility library for Android
Stars: ✭ 45 (-25%)
Mutual labels:  utility
Pinku
A Pinboard-to-buku importation utility
Stars: ✭ 30 (-50%)
Mutual labels:  utility
Is Empty
Check whether a value is empty.
Stars: ✭ 47 (-21.67%)
Mutual labels:  utility
Goat
POSIX-compliant shell movement boosting hack for real ninjas (aka `cd x` and `cd ...`)
Stars: ✭ 27 (-55%)
Mutual labels:  utility
Qrcp
⚡ Transfer files over wifi from your computer to your mobile device by scanning a QR code without leaving the terminal.
Stars: ✭ 8,216 (+13593.33%)
Mutual labels:  utility
Microtext.js
A micro JavaScript utility for processing text.
Stars: ✭ 59 (-1.67%)
Mutual labels:  utility
Yippy
macOS open source clipboard manager
Stars: ✭ 57 (-5%)
Mutual labels:  utility
Jj
JSON Stream Editor (command line utility)
Stars: ✭ 1,033 (+1621.67%)
Mutual labels:  utility

ZPLUtility

A .net library helping to generate ZPL string. Please refer to the Programming Guide for raw ZPL code definitaion, https://www.zebra.com/content/dam/zebra/manuals/en-us/software/zpl-zbi2-pm-en.pdf

https://github.com/robmachado/webetiq/blob/master/local/Doc/zpl-zbi2-pm-en.pdf

Some basic ZPL elements are included, if you have any suggestions please feel free to let me know.

NuGet-Stable

You can test generated ZPL code at http://labelary.com/viewer.html

Usage:

Single element

var result = new ZPLGraphicBox(100, 100, 100, 100).ToZPLString();
Console.WriteLine(result); 
//Output
//^FO100,100
//^GB100,100,1,B,0^FS

Barcode

var result = new ZPLBarCode128("123ABC", 100, 300).ToZPLString();
Console.WriteLine(result);
//Output
//^FO100,300
//^BCN,100,Y,N
//^FD123ABC^FS

Whole label

var sampleText = "[_~^][LineBreak\n][The quick fox jumps over the lazy dog.]";
ZPLFont font = new ZPLFont(fontWidth: 50, fontHeight: 50);
var labelElements = new List<ZPLElementBase>();
labelElements.Add(new ZPLTextField(sampleText, 50, 100, font));
labelElements.Add(new ZPLGraphicBox(400, 700, 100, 100, 5));
labelElements.Add(new ZPLGraphicBox(450, 750, 100, 100, 50, ZPLConstants.LineColor.White));
labelElements.Add(new ZPLGraphicCircle(400, 700, 100, 5));
labelElements.Add(new ZPLGraphicDiagonalLine(400, 700, 100, 50, 5));
labelElements.Add(new ZPLGraphicDiagonalLine(400, 700, 50, 100, 5));
labelElements.Add(new ZPLGraphicSymbol(ZPLGraphicSymbol.GraphicSymbolCharacter.Copyright, 600, 600, 50, 50));

//Add raw ZPL code
labelElements.Add(new ZPLRaw("^FO200, 200^GB300, 200, 10 ^FS"));

var renderEngine = new ZPLEngine(labelElements);
var output = renderEngine.ToZPLString(new ZPLRenderOptions() { AddEmptyLineBeforeElementStart = true });

Console.WriteLine(output);

Simple layout

var elements = new List<ZPLElementBase>();

var o = new ZPLOrigin(100, 100);
for (int i = 0; i < 3; i++)
{
    for (int j = 0; j < 3; j++)
    {
        elements.Add(new ZPLGraphicBox(o.PositionX, o.PositionY, 50, 50));
        o = o.Offset(0, 100);
    }
    o = o.Offset(100, -300);
}

var options = new ZPLRenderOptions();
var output = new ZPLEngine(elements).ToZPLString(options);

Console.WriteLine(output);

Auto scale based on DPI

var labelElements = new List<ZPLElementBase>();
labelElements.Add(new ZPLGraphicBox(400, 700, 100, 100, 5));

var options = new ZPLRenderOptions() { SourcePrintDPI = 203, TargetPrintDPI = 300 };
var output = new ZPLEngine(labelElements).ToZPLString(options);

Console.WriteLine(output);

Render with comment for easy debugging

var labelElements = new List<ZPLElementBase>();

var textField = new ZPLTextField("AAA", 50, 100, ZPLConstants.Font.Default);
textField.Comments.Add("An important field");
labelElements.Add(textField);

var renderEngine = new ZPLEngine(labelElements);
var output = renderEngine.ToZPLString(new ZPLRenderOptions() { DisplayComments = true });

Console.WriteLine(output);

Different text field type

var sampleText = "[_~^][LineBreak\n][The quick fox jumps over the lazy dog.]";
ZPLFont font = new ZPLFont(fontWidth: 50, fontHeight: 50);

var labelElements = new List<ZPLElementBase>();
//Specail character is repalced with space
labelElements.Add(new ZPLTextField(sampleText, 10, 10, font, useHexadecimalIndicator: false));
//Specail character is repalced Hex value using ^FH
labelElements.Add(new ZPLTextField(sampleText, 10, 50, font, useHexadecimalIndicator: true));
//Only the first line is displayed
labelElements.Add(new ZPLSingleLineFieldBlock(sampleText, 10, 150, 500, font));
//Max 2 lines, text exceeding the maximum number of lines overwrites the last line.
labelElements.Add(new ZPLFieldBlock(sampleText, 10, 300, 400, font, 2));
// Multi - line text within a box region
labelElements.Add(new ZPLTextBlock(sampleText, 10, 600, 400, 100, font));

var renderEngine = new ZPLEngine(labelElements);
var output = renderEngine.ToZPLString(new ZPLRenderOptions() { AddEmptyLineBeforeElementStart = true });

Console.WriteLine(output);

Draw pictures, auto resize based on DPI (Please dither the colorful picture first)

You have 2 options:

  1. Use ~DY and ^IM
var elements = new List<ZPLElementBase>();
elements.Add(new ZPLGraphicBox(0, 0, 100, 100, 4));
elements.Add(new ZPLDownloadObjects('R', "SAMPLE.PNG", new System.Drawing.Bitmap("sample.bmp")));
elements.Add(new ZPLImageMove(100, 100, 'R', "SAMPLE", "PNG"));

var renderEngine = new ZPLEngine(elements);
var output = renderEngine.ToZPLString(new ZPLRenderOptions() { AddEmptyLineBeforeElementStart = true, TargetPrintDPI = 300, SourcePrintDPI = 200 });

Console.WriteLine(output);
  1. Use ~DG and ^XG
var elements = new List<ZPLElementBase>();
elements.Add(new ZPLDownloadGraphics('R', "SAMPLE", "GRC", new System.Drawing.Bitmap("Sample.bmp")));
elements.Add(new ZPLRecallGraphic(100, 100, 'R', "SAMPLE", "GRC"));

var renderEngine = new ZPLEngine(elements);
var output = renderEngine.ToZPLString(new ZPLRenderOptions() { AddEmptyLineBeforeElementStart = true, TargetPrintDPI = 600, SourcePrintDPI = 200 });

Console.WriteLine(output);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].