Giter VIP home page Giter VIP logo

binarykits / binarykits.zpl Goto Github PK

View Code? Open in Web Editor NEW
283.0 20.0 99.0 933 KB

BinaryKits.Zpl a set of .net libraries. The project supports you in the simple creation of zebra labels. It generates the ZPL data, it is a printer description language from Zebra Technologies. ZPL II is now emulated by many label printers from different manufacturers. So with this implementation you can create labels for most printers.

License: MIT License

C# 97.07% HTML 2.72% Dockerfile 0.21%
zpl zebra zebra-printer zpl2 zpl-commands dotnet csharp labelprinter zebra-label-printers labelary

binarykits.zpl's Introduction

BinaryKits.Zpl

This project contains several modules for working with Zebra Programming Language. ZPL is a very common printer language that is supported by various manufacturers. The project helps you to describe a label and generates a preview from the ZPL data. We can convert different image formats to the Zebra image format. The image data is compressed to cause as little traffic as possible. More information about Zebra printer languages can be found in the ZPL Documentation.

What modules does the project offer

  • BinaryKits.Zpl.Label
    This module provides the basic building blocks of the ZPL language and the logic for converting the images into the correct format.
  • BinaryKits.Zpl.Labelary
    This module is a client for the Labelary project with which a preview can be generated from ZPL data.
  • BinaryKits.Zpl.Protocol
    This module contains the raw commands of the Zebra protocol.
  • BinaryKits.Zpl.Viewer
    This module is our own implementation of a viewer. It converts the ZPL data into an image like Labelary but does it locally. Try our viewer. The viewer is also available as a docker container

How can I use it?

The packages are available via:

Package Manager .NET CLI
PM> install-package BinaryKits.Zpl.Label > dotnet add package BinaryKits.Zpl.Label NuGet
PM> install-package BinaryKits.Zpl.Labelary > dotnet add package BinaryKits.Zpl.Labelary NuGet
PM> install-package BinaryKits.Zpl.Viewer > dotnet add package BinaryKits.Zpl.Viewer NuGet
PM> install-package BinaryKits.Zpl.Protocol > dotnet add package BinaryKits.Zpl.Protocol NuGet

Supported Elements

This library supports following elements:

Element Informations
Barcode ANSI Codabar, Code 39, Code 128, EAN-13, Interleaved 2 of 5
QR-Code -
Image DownloadObjects, DownloadGraphics
Text TextBlock, TextField, FieldBlock, SingleLineFieldBlock
Drawing GraphicBox, DiagonalLine, Circle, Ellipse

Is there a way to generate a preview?

There are several ways to view the result from the ZPL data.

Variant Description
labelary.com A widely used and accurate solution. Unfortunately, there is no information who runs the project. Therefore, no customer information should be sent to this service.
BinaryKits.Zpl.Viewer This viewer is part of our project, it is open source and can be easily used on your infrastructure. Demo
Zpl Printer A Chrome plugin that simulates a network printer on port 9100 in the background the label is then sent to a Labelary API and displayed.

How can I send the generated data to my printer?

For example, the data can be transmitted to the printer IpAddress on port 9100.

var zplData = @"^XA^MMP^PW300^LS0^LT0^FT10,60^APN,30,30^FH\^FDSAMPLE TEXT^FS^XZ";
// Open connection
var tcpClient = new System.Net.Sockets.TcpClient();
tcpClient.Connect("10.10.5.85", 9100);

// Send Zpl data to printer
var writer = new System.IO.StreamWriter(tcpClient.GetStream());
writer.Write(zplData);
writer.Flush();

// Close Connection
writer.Close();
tcpClient.Close();

Examples to describe Labels

Using statement

using BinaryKits.Zpl.Label;
using BinaryKits.Zpl.Label.Elements;

Single element

var output = new ZplGraphicBox(100, 100, 100, 100).ToZplString();
Console.WriteLine(output);

Barcode 128

var output = new ZplBarcode128("123ABC", 10, 50).ToZplString();
Console.WriteLine(output);

Barcode 128

Whole label

var sampleText = "[_~^][LineBreak\n][The quick fox jumps over the lazy dog.]";
var font = new ZplFont(fontWidth: 50, fontHeight: 50);
var elements = new List<ZplElementBase>();
elements.Add(new ZplTextField(sampleText, 50, 100, font));
elements.Add(new ZplGraphicBox(400, 700, 100, 100, 5));
elements.Add(new ZplGraphicBox(450, 750, 100, 100, 50, LineColor.White));
elements.Add(new ZplGraphicCircle(400, 700, 100, 5));
elements.Add(new ZplGraphicDiagonalLine(400, 700, 100, 50, 5));
elements.Add(new ZplGraphicDiagonalLine(400, 700, 50, 100, 5));
elements.Add(new ZplGraphicSymbol(GraphicSymbolCharacter.Copyright, 600, 600, 50, 50));

// Add raw Zpl code
elements.Add(new ZplRaw("^FO200, 200^GB300, 200, 10 ^FS"));

var renderEngine = new ZplEngine(elements);
var output = renderEngine.ToZplString(new ZplRenderOptions { AddEmptyLineBeforeElementStart = true });

Console.WriteLine(output);

Sample code: https://dotnetfiddle.net/cnJ1XG

Whole label

Simple layout

var elements = new List<ZplElementBase>();

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

var options = new ZplRenderOptions();
var output = new ZplEngine(elements).ToZplString(options);

Console.WriteLine(output);

Simple layout

Auto scale based on DPI

var elements = new List<ZplElementBase>();
elements.Add(new ZplGraphicBox(400, 700, 100, 100, 5));

var options = new ZplRenderOptions { SourcePrintDpi = 203, TargetPrintDpi = 300 };
var output = new ZplEngine(elements).ToZplString(options);

Console.WriteLine(output);

Render with comment for easy debugging

var elements = new List<ZplElementBase>();

var textField = new ZplTextField("AAA", 50, 100, ZplConstants.Font.Default);
textField.Comments.Add("An important field");
elements.Add(textField);

var renderEngine = new ZplEngine(elements);
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.]";
var font = new ZplFont(fontWidth: 50, fontHeight: 50);

var elements = new List<ZplElementBase>();
// Special character is repalced with space
elements.Add(new ZplextField(sampleText, 10, 10, font, useHexadecimalIndicator: false));
// Special character is repalced Hex value using ^FH
elements.Add(new ZplTextField(sampleText, 10, 50, font, useHexadecimalIndicator: true));
// Only the first line is displayed
elements.Add(new ZplSingleLineFieldBlock(sampleText, 10, 150, 500, font));
// Max 2 lines, text exceeding the maximum number of lines overwrites the last line.
elements.Add(new ZplFieldBlock(sampleText, 10, 300, 400, font, 2));
// Multi - line text within a box region
elements.Add(new ZplTextBlock(sampleText, 10, 600, 400, 100, font));

var renderEngine = new ZplEngine(elements);
var output = renderEngine.ToZplString(new ZplRenderOptions { AddEmptyLineBeforeElementStart = true });

Console.WriteLine(output);

Draw pictures

For the best image result, first convert your graphic to black and white. The library auto resize the image based on DPI.

You have 2 possibilities to transfer the graphic to the printer:

1. ZplDownloadObjects (Use ~DY and ^IM)

With this option, the image is sent to the printer in the original graphic format and the printer converts the graphic to a black and white graphic

var elements = new List<ZplElementBase>();
elements.Add(new ZplDownloadObjects('R', "SAMPLE.BMP", System.IO.File.ReadAllBytes("sample.bmp")));
elements.Add(new ZplImageMove(100, 100, 'R', "SAMPLE", "BMP"));

var renderEngine = new ZplEngine(elements);
var output = renderEngine.ToZplString(new ZplRenderOptions { AddEmptyLineBeforeElementStart = true, TargetPrintDpi = 300, SourcePrintDpi = 200 });

Console.WriteLine(output);

2. ZplDownloadGraphics (Use ~DG and ^XG)

With this option, the image is converted from the library into a black and white graphic and the printer already receives the finished print data

var elements = new List<ZplElementBase>();
elements.Add(new ZplDownloadGraphics('R', "SAMPLE", System.IO.File.ReadAllBytes("sample.bmp")));
elements.Add(new ZplRecallGraphic(100, 100, 'R', "SAMPLE"));

var renderEngine = new ZplEngine(elements);
var output = renderEngine.ToZplString(new ZplRenderOptions { AddEmptyLineBeforeElementStart = true, TargetPrintDpi = 600, SourcePrintDpi = 200 });

Console.WriteLine(output);

Sample code: https://dotnetfiddle.net/ug84VY

Example to use the Viewer

IPrinterStorage printerStorage = new PrinterStorage();
var drawer = new ZplElementDrawer(printerStorage);

var analyzer = new ZplAnalyzer(printerStorage);
var analyzeInfo = analyzer.Analyze("^XA^FT100,100^A0N,67,0^FDTestLabel^FS^XZ");

foreach (var labelInfo in analyzeInfo.LabelInfos)
{
    var imageData = drawer.Draw(labelInfo.ZplElements);
    File.WriteAllBytes("label.png", imageData);
}

Font mapping

ZPL font download commands are not supported. You can provide a font mapping logic to the viewer if:

  • You are hosting or using the BinaryKits.Zpl.Viewer
  • The font is properly installed on the system
using SkiaSharp;

string zplString = @"^XA^FO20, 20^A1N,40, 30 ^FD่ฅฟ็“œ^FS^FO20, 50^A0N,40, 30 ^FDABCDEFG^FS^XZ";

var drawOptions = new DrawerOptions()
{
    FontLoader = fontName =>
    {
        if (fontName == "0")
        {
            return SKTypeface.FromFamilyName("Arial", SKFontStyleWeight.Bold, SKFontStyleWidth.Normal, SKFontStyleSlant.Upright);
        }
        else if (fontName == "1")
        {
            return SKTypeface.FromFamilyName("SIMSUN");
        }

        return SKTypeface.Default;
    }
};

IPrinterStorage printerStorage = new PrinterStorage();
var drawer = new ZplElementDrawer(printerStorage, drawOptions);
var analyzer = new ZplAnalyzer(printerStorage);
var analyzeInfo = analyzer.Analyze(zplString);

foreach (var labelInfo in analyzeInfo.LabelInfos)
{
    var imageData = drawer.Draw(labelInfo.ZplElements, 300, 300, 8);
    File.WriteAllBytes("test.png", imageData);
}

Printer manufacturers that support zpl

Manufacturer Simulator
Zebra Technologies -
Honeywell International Inc ZSIM
Avery Dennison MLI (Monarch Language Interpreter)
cab Produkttechnik GmbH & Co. KG
AirTrack
SATO SZPL
printronix ZGL
Toshiba Tec
GoDEX GZPL

Alternative projects

Language Project
JavaScript JSZPL
.NET sharpzebra
.NET PDFtoZPL

binarykits.zpl's People

Contributors

brendonparker avatar daanggc avatar danzk avatar egalia avatar gmanucci avatar ingfdoaguirre avatar m-mommsen avatar primo-ppcg avatar remco1271 avatar tinohager avatar tom-peffer-mesalvo avatar travisterrell avatar wboxx1 avatar yelhouti avatar yipingruan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

binarykits.zpl's Issues

wrong presentation in viwer whith ^FB and ^FH

Hello!
i want to create a label for a Price Tag but when i use
labelary.com it show right :
image
but in BinaryKits.Zpl.Viewer show me :
image
this is zpl text for a label 60*30 mm
^XA^MMT^PW320^LL0240^LS0 ^FT5,75 ^A0N,38,31 ^FB320,2,0,C ^FDPRODUCT NAME ^FS ^FT29,195 ^A0N,71,88 ^FH\^FD\15 15.00 ^FS ^PQ1,0,1,Y ^XZ

Image not rendered correctly

Using code

 IPrinterStorage printerStorage = new PrinterStorage();
 var analyzer = new ZplAnalyzer(printerStorage);
 var elements = analyzer.Analyze(zplCommands);

 var drawer = new ZplElementDrawer(printerStorage);
 var imageData = drawer.Draw(elements);

Image is not rendered correctly from ZPL commands. Using labelary viewer I checked that ZPL commands are correct. Rendered image is attached to this issue.

Any suggestions what could be wrong?
cbimage

Field Number (^FN) and Recall / Download Format (^DF, ^XF)

Hello,

For a project I needed to handle ^FN, ^DF and ^XF commands in existing .zpl files (I cannot change those files).

DF : "template" declaration
XF : "template" usage
FN : field declaration and usage
Details here : https://www.servopack.de/support/zebra/ZPLII-Prog.pdf

In order to do that, I had to make a few changes to the lib :

  • Added FieldNumberCommandAnalyzer, DownloadFormatCommandAnalyzer, RecallFormatCommandAnalyzer
  • Added ZplFieldNumber and ZplRecallFormat elements
  • Updated FieldDataZplCommandAnalyzer to return an element matching ^FN...^FD... pair
  • Updated FieldSeparatorZplCommandAnalyzer to return an element matching trailing ^FN commands before ^FS
  • Added DownloadFormatName property in LabelInfo class
  • Added few properties to VirtualPrinter
  • Added format merging in ZplAnalyzer

Can I create a pull request so that those new features are available for everyone ?

No parameter ModuleWidth(^BY width) added after and set to initialized a type of barcode

^BY Configures the global bar code defaults. Width: any number between 1 and 100 may be used. The default value is the previously configured value, or 2 if no value has been set. Code example:

int x = 100;
int y = 76;
int height = 55;
int moduleWidth = 5;
double wideBar = 2.5;

var barCode131 = new ZplBarcodeEan13("8313532300305", x, y, height, moduleWidth, wideBar);
var barCode132 = new ZplBarcodeEan13("8313532300305", x, y, height, moduleWidth, wideBar, FieldOrientation.Normal, true, false);
var barCode133 = new ZplBarcodeEan13("8313532300305", x, y, height, moduleWidth, wideBar, FieldOrientation.Normal, true, false);

After export ToZplString(new ZplRenderOptions()), ^BY(moduleWidth) is miss and is not setted to the barcode. Any suggestion.

Publish docker image in dockerhub?

Hello and thanks for this awesome project! Our team has been searching for an offline ZPL viewer and this project looks like a great fit for our purposes. Do you have any plans to publish the viewer api as a docker image in DockerHub at some point? It should be pretty straightforward since you already provide a dockerfile in src folder to build the viewer api.

Cheers!

How can I use Zpl.Viewer in a .NET Framework App?

The nuget package BianryKits.Zpl.Viewer requires .NET Standard2.1, but event the latest .NET Framework doesn't support .NET Standard2.1 (see this).
So, is there any way for me to use the Zpl.Viewer in a .NET Framework APP? Thanks in advance.

Generated Qr Code missing first Letter

Hi, using the default QrCode element generates a Qr that misses the first letter
example:

LabelElements.Add(new ZPLQRCode("ACP001", 10, 20,2, 10));

The Generated QrCode is "CP001"
And the Zpl Line responsible is ^FDQM,ACP001^FS

Note that the default ErrorCorrection Q is present followed by the Data Input "M" which should be "A" to correct the problem

Viewer doesn't display barcode and doesn't properly relate dpmm to image size

Barcode not rendered

#1 The viewer doesn't render a barcode embedded in the zpl code used. See the attached images, where an image created via labelary and an image created with BinaryKits.Zpl.Viewer are shown.

Relation of label size to dpmm and resulting image unclear or wrong

#2 The way BinaryKits.Zpl.Viewer relates the specified image size [mm] to the resolution [dpmm] is unclear. The resulting image should always be filled with the label contents and the image dimensions should depend on the dpmm given (bigger dpmm -> bigger image). Right now, the higher the dpmm in relation to the specified label size, the less space the label contents take up in the image. The third screenshot from the attachment shows that: The label contents is barely recognizeable in the upper left corner of the image (40x35mm @ 208dpmm).

Environment

Blazor client/server application. BinaryKits.Zpl.Viewer is running on the server because Skia won't run in a Webassembly, so the label image cannot be rendered on the (browser based) client.

Attachments

The two images below with code snippets show the razor/HTML code used to render the image and the cs code to have BinaryKits.Zpl.Viewer create the image (server side) and to respond to a request URI asking for the image.

BinaryKits.Viewer.Zpl, 40x35mm @ 8 dpmm

BinaryKits Zpl Viewer 40x35@8

Labelary 1.6x1.5 @ 8 dpmm

Labelary 1_6x1_5@8

BinaryKits.Viewer.Zpl, 40x35mm @ 208 dpmm

BinaryKits Zpl Viewer 40x35@208

Label image rendering

label display code

Label image creation and HTTP request response service

label creation code

zpl code used (line breaks inserted after every comma for better representation here; The original code has no line breaks)

^XA\n^LH0,
0\n^CI28\n\n^LL280^PW320\n\n^A0N,
18,
18\n^FO0,
16\n^FB304,
3,
0,
L,
0\n^FH^FDSplitstab ## L=40 cm ^FS\n\n^A0N,
20,
20\n^FO0,
80\n^FH^FD500 Stรผck pro Bund^FS\n\n^A0N,
30,
30\n^FO0,
112\n^FH^FDโ‚ฌ 10,
90^FS\n\n^A0N,
18,
18\n^FO0,
142\n^FB304,
1,
0,
C,
0\n^FH^FD3.03 - 1^FS\n\n^FO54,
162\n^BY2,
,
\n^BEN,
40,
Y,
N\n^FD200000030301^FS\n\n^FO36,
218\n\n^GFA,
1450,
1450,
29,
gN02,
gN0F,
gM03FC,
gM03FF,
:gM03FB,
gK0203F8,
gK0383FC,
gG0FC003E1FE6001F801FF,
W01E03FF803E0IF007FE03FF,
W0720600803C0FF980C0102,
X02020180383FF980C0183FE,
X0203FF0033IFC807FF83FF8,
X020600C03JFEI0E18I08,
X020600C03IFE6J01J08,
X0203FF800IF06007FE03FF,
gG0FEI07F80C001F8007C,
gL03F00C,
gL03E,
gL07E,
gL067,
gL031C,
gL0186,
gL01E,
gM06,
,
:::N06gM018,
N07gM01C,
:03IF803KFC0207FE003FFEJ01IF001CJ03F001FFEI0C1FFC1KF07KFE073IF01JFC001KF81CJ0FE01JFC00CIFC7KF03KFE07JF03KF003FF3FF81CI07F003KF00JFC7M07L07EJ0F8I0F807CI0381C001F80078I0F80F8,
EM07L078J0EJ0780FL01C00FEI0EJ0380E,
EM07L07J01CJ0381EL01C03FI01EJ03C0E,
EM07L07J01CJ0181CL01C1FCI01CJ01C0E,
7CL07L07J01CJ0381CL01IFJ01CJ01C0E,
7KF007L07J01LF81CL01FFCJ01LFC0E,
1KF807L07J01LF81CL01IFJ01LF80E,
K03807L07J01CL01CL01C1FCI01CM0E,
K01C07L07J01CL01CL01C07FI01CM0E,
K01C07L07J01CL01EL01C00FC001CM0E,
K03C078K07K0EM0FL01C003FI0EM0E,
K07803CK07K0F8I0180F8I0381CI0FE00F8I0180E,
7FE0FF801JFE07K07FE1FF807KF81CI03F807FE1FF80E,
7KFI0JFE07K01KF801KF81CJ0FE01KF80E,
0JFK0IF003L03IFJ01FFE0018J01F003IFI0C,
^FS\n\n^A0N,
18,
18\n^FO128,
100\n^FB304,
1,
0,
L,
0\n^FH^FDab 10 VE^FS\n\n^A0N,
18,
18\n^FO0,
100\n^FB304,
1,
0,
R,
0\n^FH^FDโ‚ฌ 10,
20^FS\n^XZ

Data matrix barcode issue

Hi

I really like this project and I have built it into one of my APIs making labels. One of my services generating labels in ZPL are including QR codes. When the data is rendered using BinaryKits the QR code shows up as text, like if the library is not able to render the QR code into the image. When I copy and paste the exact same ZPL payload into Labelary I get the QR code showing up correctly. I tried changing the QR code from BXN to BQN and that generated the QR code, but the format and location inside the label was wrong. Because I get the data from a third-party provider I am not able to change BXN to BQN when data is generated.

My expectation was a QR code generated from this ZPL command:

^FO70,214^BXN,4,200^FR^FDbarcode data here

Can I do anything to get the QR code printed on the image?

Viewer - FB Command is not rendered correctly

The ZPL command FB (Field Block) command is not rendered correctly. I use the currently newest nuget package Zpl.Previewer 1.0.3.

The official doc says that:

The ^FB command allows you to print text into a defined block type format.

The picture below ilustrate how FB affects the printed label.
image

In the Zpl.Previewer, however, the FB command won't affect the renderend image. It doesn't make difference whether I use the FB command or not.

SkiaSharp on Linux and prepare docker

To make the viewer work on Linux, seems we need to add the following to "BinaryKits.Zpl.Viewer.csproj" (tested)

    <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.80.3" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.80.3" />

mono/SkiaSharp#1341

Otherwise:
image

Barcode Text not rendered in Viewer output

Using:

.NET Framework 4.7.2
BinaryKits.Zpl.Label 3.1.0
BinaryKits.Zpl.Viewer 1.1.1

All other dependencies up to date.

Method for creating label preview:

DialogResult result = this.openFileDialog.ShowDialog();
if(result == DialogResult.OK) {
    string content = File.ReadAllText(this.openFileDialog.FileName);

    IPrinterStorage printerStorage = new PrinterStorage();
    ZplElementDrawer drawer = new ZplElementDrawer(printerStorage);

    ZplAnalyzer analyzer = new ZplAnalyzer(printerStorage);
    AnalyzeInfo analyzeInfo = analyzer.Analyze(content);

    foreach(LabelInfo labelInfo in analyzeInfo.LabelInfos) {
        byte[] labelData = drawer.Draw(labelInfo.ZplElements);
        File.WriteAllBytes("label.png", labelData);
    }
}

Using this sample label data:

^XA

^BY3,2,100
^FO100,750,^BC^FDTEST0123456789^FS

^XZ

Actual:

Expected (labelary.com reference):

skiaSharp 2.80.3 usage

Hi, This nuget package is very helpful. Thank you for creating it. The requirement for this package is to have skiaSharp >= 2.80.3. But there is an issue with this version: mono/SkiaSharp#1860 mono/SkiaSharp#1767
It works with skiaSharp version 2.80.2. There is any issue with using this version?

Inconsistent image result on Linux

Test fail for DownloadGraphics and DownloadObjets

@tinohager maybe get from a real image instead of drawing?
https://github.com/BinaryKits/ZPLUtility/blob/1a89c5d66122f4e32bbcf4940cf7cb01b98bdad6/src/BinaryKits.ZplUtility.UnitTest/DownloadTest.cs#L12

image

DownloadGraphics ``` Failed DownloadGraphics [188 ms] Error Message: Assert.AreEqual failed. Expected:<^XA ^LH0,0 ^CI28

^FO0,0
^GB100,100,4,B,0^FS

~DGR:SAMPLE.GRC,260,13,
,::J0G8G3GFG0G7G8G0G1G0GEG1GCG0G8G1GFGDGFGCG7G8G0I0G1G8G2G0H8G4G0G3H1H2G1G8G0G2G1H0G8G4G0I0G1G4G2G0G9G0G4G0G7H1G0G2G1G8G0G2G1H0G8G2G0I0G2G4G2G0G1I0G1G0G1G0H2G8G0G2G1H0G8H0I0H2G3GFG1I0G1G0G3G0GCG0G8G0G2G1GFG8G7H0I0I2G0G9I0G1G0G2G0G2G4G8G0G2G1H0G1GCG0I0G7GEG2G0G9I0G1G0G4G0G2H8G0G2G1I0G2G0H0G3YFGEG8G2G0I0G8G1G2G0H8G4G0H1G0H2G0G8G0G2G1H0GCG6G0I0G8G1GBGFG0G7G8G0G1G3GFG1GCG0G8G0G2G1GFGCG7G8G0,::::::

^FO100,100
^XGR:SAMPLE.GRC,1,1,
^XZ>. Actual:<^XA
^LH0,0
^CI28

^FO0,0
^GB100,100,4,B,0^FS

~DGR:SAMPLE.GRC,260,13,
,::::I0G1G0G7GEG0GFH0G3G0GFG1GEG0GCG1GFGEGFGEG3GEG0I0G2G8G4G2G1G0GCG0GFH1H2G1GCG0G3G0G8G0G6G3G0I0G2G8G4G3G2I0G3G0G1G8G3G1G4G0G3G0G8G0G4H0I0I4H2I0G3G0G1G0H2G4G0G3G0G8G0G6H0I0H4G7GEG2I0G3G0G3G0GCG6G4G0G3G0GFGEG1GEG0H0G3YFGEG0G3G0I0G8G2G4G1G2G0G4G0G3G0G8G0G1GFGEG0G3G0G8H0G1G0I0G8G2G4G3G1G0GCG0G3G1G0G2G3G0G4G0G3G0G8G0G6G1G0H0G1G0G3G7GEG0GFH0GFGDGFG9GEG0G4G0G3G0GFGEG3GEG0,:::::

^FO100,100
^XGR:SAMPLE.GRC,1,1,
^XZ>.
Stack Trace:
at BinaryKits.ZplUtility.UnitTest.DownloadTest.DownloadGraphics() in /home/yiping/Documents/repo/github/ZPLUtility/src/BinaryKits.ZplUtility.UnitTest/DownloadTest.cs:line 43

Standard Output Messages:

Debug Trace:
^XA
^LH0,0
^CI28

^FO0,0
^GB100,100,4,B,0^FS

~DGR:SAMPLE.GRC,260,13,
,::::I0G1G0G7GEG0GFH0G3G0GFG1GEG0GCG1GFGEGFGEG3GEG0I0G2G8G4G2G1G0GCG0GFH1H2G1GCG0G3G0G8G0G6G3G0I0G2G8G4G3G2I0G3G0G1G8G3G1G4G0G3G0G8G0G4H0I0I4H2I0G3G0G1G0H2G4G0G3G0G8G0G6H0I0H4G7GEG2I0G3G0G3G0GCG6G4G0G3G0GFGEG1GEG0H0G3YFGEG0G3G0I0G8G2G4G1G2G0G4G0G3G0G8G0G1GFGEG0G3G0G8H0G1G0I0G8G2G4G3G1G0GCG0G3G1G0G2G3G0G4G0G3G0G8G0G6G1G0H0G1G0G3G7GEG0GFH0GFGDGFG9GEG0G4G0G3G0GFGEG3GEG0,:::::

^FO100,100
^XGR:SAMPLE.GRC,1,1,
^XZ


</details>

UPS ZPL fails to render

I have ZPL labels that I get from UPS that render fine on Labelary (with some warnings), but seem to crash the viewer service

test.zip

Text on labels is narrow after updating to latest version

Hi

After updating the NuGet package to the latest version the text height on the labels I draw using this library has become small. I tried reverting back to an older package and the labels looked good again in a matter of text height. Also, the barcode positions are a little bit off. The last barcode is rendered outside the label. I have tried generating a label on labelary.com to test if it was just the label that had some errors in the ZPL code.

Below are two images, one from the render using BinaryKits and the other one is from labelary.com. Sorry, I had to blur the details - I know it makes it harder to see what I mean. Below is also a screenshot of the demo label I have made.

Labelary.com

Label generated using labelary

BinaryKits.ZPL

Label generated using BinaryKits{: width="250px"}.

ZPL

^XA ^FT22,43 ^A0N,,36 ^FDEXPRESS WORLDWIDE^FS ^FT22,43 ^A0N,,36 ^FDEXPRESS WORLDWIDE^FS ^FT23,70 ^A0N,,15 ^FDDate and Company^FS ^FO386,0 ^GB150,79,79,B^FS ^FT388,58 ^A0N,,65 ^FR^FDWPX^FS ^FO543,23 ^IMR:dhllg1.GRF^FS ^FO0,78 ^GB780,0,2,B^FS ^FT19,102 ^A0N,,17 ^FDFrom :^FS ^FT19,102 ^A0N,,17 ^FDFrom :^FS ^FT87,102 ^A0N,,25 ^FDCompany Name^FS ^FT87,129 ^A0N,,25 ^FDSender Name^FS ^FT87,156 ^A0N,,25 ^FDAddress1^FS ^FT87,182 ^A0N,,25 ^FDZip, City^FS ^FT87,209 ^A0N,,25 ^FDCountry^FS ^FT693,102 ^A0N,,22 ^FDOrigin:^FS ^FT694,140 ^A0N,,41 ^FDBLL^FS ^FT693,140 ^A0N,,41 ^FDBLL^FS ^FO0,220 ^GB780,0,2,B^FS ^FT35,252 ^A0N,,17 ^FDTo :^FS ^FT35,252 ^A0N,,17 ^FDTo :^FS ^FO25,226 ^GB2,31,5,B^FS ^FO28,224 ^GB31,0,5,B^FS ^FO750,226 ^GB2,31,5,B^FS ^FO720,224 ^GB31,0,5,B^FS ^FO25,409 ^GB2,31,5,B^FS ^FO28,439 ^GB31,0,5,B^FS ^FO750,409 ^GB2,31,5,B^FS ^FO720,439 ^GB31,0,5,B^FS ^FT87,249 ^A0N,,31 ^FDReceiver Company^FS ^FT87,282 ^A0N,,31 ^FDReceiver Name^FS ^FT87,316 ^A0N,,31 ^FDAttention^FS ^FT87,349 ^A0N,,31 ^FDAddress1^FS ^FT87,390 ^A0N,,40 ^FDZip, City^FS ^FT87,390 ^A0N,,40 ^FD^FS ^FT87,434 ^A0N,,40 ^FDCountry^FS ^FT87,434 ^A0N,,40 ^FD^FS ^FT575,244 ^A0N,,20 ^FDContact:^FS ^FO0,448 ^GB780,0,2,B^FS ^FT8,518 ^A0N,,90 ^FD.^FS ^FT204,510 ^A0N,,58 ^FDXX-XXX-XXX^FS ^FT203,510 ^A0N,,58 ^FDXX-XXX-XXX^FS ^FT744,518 ^A0N,,90 ^FD.^FS ^FO0,535 ^GB780,0,2,B^FS ^FO0,535 ^GFA,192,192,3,ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00000000^FS ^FO16,535 ^GB551,63,63,B^FS ^FT19,581 ^A0N,,48 ^FR^FDC-RET^FS ^FT701,551 ^A0N,,17 ^FDTime^FS ^FT626,551 ^A0N,,17 ^FDDay^FS ^FO0,598 ^GB780,0,2,B^FS ^FT12,656 ^A0N,,25 ^FDRef No: Some Reference No. Here^FS ^FT12,656 ^A0N,,25 ^FDRef No: Some Reference No. Here^FS ^FT524,615 ^A0N,,17 ^FDPce/Shpt Weight^FS ^FT700,615 ^A0N,,17 ^FDPiece^FS ^FT510,650 ^A0N,,28 ^FD1.0/39.0 kg^FS ^FT509,650 ^A0N,,28 ^FD1.0/39.0 kg^FS ^FT686,654 ^A0N,,41 ^FD1/2^FS ^FT686,654 ^A0N,,41 ^FD1/2^FS ^FT12,675 ^A0N,,17 ^FDContent : Demo content inside box^FS ^FO0,781 ^GB780,0,2,B^FS ^FO39,802 ^BY3,2.3,94 ^B3N,N,94,N,N ^FD1111111111^FS ^FT165,917 ^A0N,,26 ^FDWAYBILL 11 1111 11 111^FS ^FO57,928 ^BY3,2.7,205 ^BCN,205,N,N,N,A ^FD2LBF:Country+123456789^FS ^FT222,1159 ^A0N,,26 ^FDCountry+123456789^FS ^FO0,1171 ^GB780,0,2,B^FS ^FT12,1203 ^A0N,,20 ^FDRef Code:^FS ^FO123,1306 ^BY3,3.0,205 ^BCN,205,N,N,N,A ^FDPACKAGEIDHERE^FS ^FT202,1533 ^A0N,,26 ^FDPACKAGE ID HERE^FS ^XZ

Demo labels

Labelary.com

Label generated using labelary

BinaryKits.ZPL

Label generated using BinaryKits

Hope you can help me clarify what is wrong. Can I replace anything inside the ZPL code before sending it to the drawer to make it better?

Dependency issues

Can the dpendency Microsoft.Extensions.Logging.Abstractions be lowered (currently >=5.0.0)? as my projects use 3.1

Text Field Rotate

Is it possible to specify text field rotation? I want to display a text field vertically (rotate 90 degree)

Is current library support this?

QR Code Bar Code - Error correction

The ^BQ command has an error correction but also the ^FD command has an error correction (Page 114)
Does anyone make sense of the documentation?

Can it be ported to .net framework 4.5?

Current supported versions are:

  • .Net Framework 4.7.2
  • .Net Core 5.0
  • .Net Standard 2.0

Can it be ported to .Net Framework 4.5?

Am I allowed to fork and port it so it support older Framework versions?

Font size calculation to pass into ZPL

I want to specify the font height and width which I'm setting in my windows applications for Label Elements. As of now I'm converting the font size as below.
font = new ZPLFont(fontWidth:0, fontHeight: (203 / 96) * (int) control.Font.SizeInPoints);
I'm scaling the ZPL elements from screen resolution DPI i.e 96 to Printer resolution DPI i.e 203.
The scaling is done properly and the output is also fine when I view it in Labelary viewer online.
But when it gets printed in the Zebra printer, the font sizes are not fitting into the Label dimension.
Given below the sample ZPL:
Label Dimension : 1.2 x 1.0 - 203 DPI

^XA
^CI28
^MMT
^PW220
^LS0
^FX ''1.2 x 1.0 Blank''
^FO106,15 ^A0N,25,25 ^FH^FD@Title@^FS
^FO10,49 ^A0N,24,0 ^FH^FD@Prepped@^FS
^FO10,76 ^A0N,24,0 ^FH^FD@Opened@^FS
^FO10,106 ^A0N,26,0 ^FH^FD@SDate@^FS
^FO120,106 ^A0N,26,0 ^FH^FD@STime@^FS
^FO10,137 ^A0N,24,0 ^FH^FD@Discard@^FS
^FO10,167 ^A0N,26,0 ^FH^FD@EDate@^FS
^FO120,167 ^A0N,26,0 ^FH^FD@ETime@^FS
^PQ
^XZ
The above command looks fine in Labelary viewer. But when printed it is not proper.
Any thoughts ?
thanks.
NK

Viewer - UPS zpl label only show layout

Hi I try to use the package to convert zpl label from UPS to image file (png)

But I only got the layout of the label

`string encodedLabel = "Cl5YQQ0KXkxSTg0KXk1OWQ0KXk1G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MDAwMDAwMDBDMTlDQzAwDQowMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwQzE5Q0MwMA0KMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMEMxOUNDMDANCjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDBDMTg4QzAwDQowMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMA0KMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDANCjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwDQpeRE4NCl5YWg0K";
string label = Base64Util.DecodeBase64(encodedLabel);

            IPrinterStorage printerStorage = new PrinterStorage();

            var analyzer = new ZplAnalyzer(printerStorage);
            var analyzeInfo = analyzer.Analyze(label);

            var drawer = new ZplElementDrawer(printerStorage);
            foreach (var labelInfo in analyzeInfo.LabelInfos)
            {
                var imageData = drawer.Draw(labelInfo.ZplElements);
                File.WriteAllBytes(tmpFile.Path, imageData);
            }`

image

BinaryKits.Zpl.Viewer status?

Hi! I was wondering what state BinaryKits.Zpl.Viewer is in; I saw it was being worked on pretty recently.

Does it render ZPL files now?
How much of the ZPL language does it support?
How much work is outstanding?
Do you need help?

Thanks!

Sam

ZPLSingleLineFieldBlock - Line Space Value

Hi,
When using ZPLSingleLineFieldBlock the line space values are not computed properly. The value 9999 is showing when it is added to the label element object but when the complete ZPL is returned from the render engine, it is having a value like 21143.

^A0N,44,44^FO29,33^FB211,9999,21143,L,0^FH^FDEnter Text^FS

The above is after getting the ZPL from render engine. I'm not able to identify from where it is getting this value.

Below is the code to add the above element.
labelElements.Add(new ZPLSingleLineFieldBlock(labelText, control.Location.X, control.Location.Y, control.Width,font, txtJustification, ZPLTextField.NewLineConversionMethod.ToSpace, true, false));

Could please let me know what is wrong with this?

thanks,
Karthik

Datamatrix support

Hi,

Are there any plans for supporting the ^BX command for creating data matrices?

-Lars

Setting label home position

By default, printing the generated ZPL string will generally result in an off-center label. Setting the label home position to 0,0 fixes this issue.

I submitted a pull request to add ^LH0,0 to the reset string, as generally it is good practice to set this when initializing. I realize that one could instead add ZPLRaw("^LH0,0"), to the element list before the other label elements. However, if we go ahead and put this as default, it will be more friendly to most users, and more advanced users can still override this position, if needed, by adding it to the label list.

If you decide not to merge the request, though, maybe it would be a good idea to add it to the README.md?

Regards,
Travis

v2 => v3

Hi @YipingRuan

From my point of view, we could release version 2. How does it look from your side?

EAN-13 bar code is not supported in Viewer

I found EAN-13 bar code is not supported in the viewer. So any element started with ^BE will be drawed as a normal label text field not a 2D barcode.
Do you guys have any plan to support this type of barcode in the Viewer?
Thanks.

Spacing Issue

I am trying to convert a ZPL text file to an image file and I am using this viewer (https://binarykits-zpl-viewer.azurewebsites.net/) to test against http://labelary.com/viewer.html. Does anyone know if labelary is automatically adding spacing and there is a problem with my code, or if the problem is binarykits? Also, is there any guidance or tutorial on how I could add the Non-supported commands to the project?

binarykits:
image
labelary:
image

ZPL Code:

^XA^MNN^LL2923^LH0,0
^TBN,788,30

^A0N,20
^FO16,94^FDOperator:^FS
^AAN,20
^FO96,95^FDBASIC PRODUCTS^FS

^FO0,736^GD3,3,1,w^FS^XZ

image

Thank you

Adding images to ZPL

Hi,
How do I add an Image (base64 encoded string) to the ZPL using your utility ?
Basically the scenario is like, the user will upload an image and I will convert them to base64 encoded string and that image needs to be printed through ZPL commands on the label.
Any suggestions ?
thanks,
Karthik. N

Install Arial font and other libraries

Hi, I was using viewer in a custom docker container, and I saw that the preview structure had errors.

So if you are using docker, in your dockerfile you need to install this:

apt update
apt install -y libfontconfig1
apt install -y libgdiplus
apt install -y ttf-mscorefonts-installer

And everything will work fine if you are having problems

Usage of NetBarcode 2.0.0-beta.1

Need to fix when they got the 2.0 version ready.
https://github.com/Tagliatti/NetBarcode

Warning: /home/runner/.dotnet/sdk/5.0.302/Sdks/NuGet.Build.Tasks.Pack/buildCrossTargeting/NuGet.Build.Tasks.Pack.targets(221,5): warning NU5104: A stable release of a package should not have a prerelease dependency. Either modify the version spec of dependency "NetBarcode [2.0.0-beta.1, )" or update the version field in the nuspec. [/home/runner/work/BinaryKits.Zpl/BinaryKits.Zpl/src/BinaryKits.Zpl.Viewer/BinaryKits.Zpl.Viewer.csproj]

Viewer - Website

It would be great if we could implement the viewer website in vue and remove the dependencies to external cdns.

Missing features on the current page

  • display if the result image is scaled (responsive change the size of the image)
  • render time
  • move test labels in a top menu
  • create a nice design for the website ๐Ÿ˜„

System.IndexOutOfRangeException: Index was outside the bounds of the array.

The following code resulted in the subsequent error message at line 22 (See commented code line text). The code is based on the Example Code shown on the BinaryKits.Zpl.Viewer source page.

Note: The zpl is indeed valid ZPL.

using System.Collections.Generic;
using System.Drawing;
using System.IO;

using BinaryKits.Zpl.Viewer;

namespace ZplToImage
{
    public class ZplConverter
    {
        public Image[] ConvertToImages(string zpl)
        {
            IPrinterStorage printerStorage = new PrinterStorage();

            var drawer = new ZplElementDrawer(printerStorage);
            var analyzer = new ZplAnalyzer(printerStorage);
            var analyzeInfo = analyzer.Analyze(zpl);
            var images = new List<Image>();

            foreach (var labelInfo in analyzeInfo.LabelInfos)
            {
                var imageBytes = drawer.Draw(labelInfo.ZplElements); // This is where the exception is thrown.
                var image = ByteArrayToImage(imageBytes);

                images.Add(image);
            }

            return images.ToArray();
        }

        public Image ByteArrayToImage(byte[] byteArrayIn)
        {
            MemoryStream ms = new MemoryStream(byteArrayIn);
            Image returnImage = Image.FromStream(ms);

            return returnImage;
        }
    }
}

status: ERROR
error.code: -2
error.description: Unexpected Error
error.message: Index was outside the bounds of the array.
error.message: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at BinaryKits.Zpl.Viewer.ZplElementDrawer.Draw(ZplElementBase[] elements, Double labelWidth, Double labelHeight, Int32 printDensityDpmm)
at ZplToImage.ZplConverter.ConvertToImages(String zpl) in C:\Users\CodegoErgoSum\source\repos\CESServices\ZplToImage\ZplConverter.cs:line 22

Parsing string to ZPL Elements

How can I reverse parse the ZPL string to corresponding list of Label Elements ? OR
How can I load a ZPL string which will be converted to corresponding Label Elements?
I have a ZPL string in which I have to modify the Y - coordinates of all elements Field Origin.
Once modified I want to scale it to the desired DPI.

Viewer convert to PDF instead image

Hi I recently made some PRs to fix some bugs.

This was the initial viewer result, before fixes:
first

And after fixes this was the result:
label0

This is the result using Labelary:
labelary

I can say that is approximately the same result, maybe your viewer needs some tune(in font sizes and types) , but nothing big.

Now that those bugs are fixed, I need want to know if can I create a PDF file instead a image files, I know that I can create a PDF and add 1 image per page, but I saw in Labelary that, when you donwload as PDF file, the resulting file doesnt have images on each PDF page, it have text.

This is an example that proves that if you download PDF from Labelary, all is rendered as text (I select it, to prove it):
2022-06-05_22-27

So can I create a PDF instead an image? or do I need to investigate and create my own function?

Thank you!

Documentation

Hello,

Im new to Zpl and this ZplUtility. Is there any available documentation of ZplUtility apart from examples in Readme.md file.

Error in ZPL.Viewer

Hello,

I get the following error with the following zpl.

image

The same thing happens with the {6} {7} {8} {9} ...
Can somebody help me?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.