11![ logo] ( assets/logo.jpg )
22
3- The ZPLForge library is aimed at people who do not want to deal directly with ZPL or read the
3+ | Package | Target framework | NuGet | CI Build |
4+ | ----------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
5+ | ** ZPLForge** | .NET Standard 2.0 | [ ![ NuGet] ( https://img.shields.io/nuget/v/ZPLForge.svg )] ( https://www.nuget.org/packages/ZPLForge/ ) | ![ .NET Core] ( https://github.com/chrishanzlik/ZPLForge/workflows/.NET%20Core/badge.svg?branch=master ) |
6+ | ** ZPLForge.XmlSerialization** | .NET Standard 2.0 | [ ![ NuGet] ( https://img.shields.io/nuget/v/ZPLForge.XmlSerialization.svg )] ( https://www.nuget.org/packages/ZPLForge.XmlSerialization/ ) | ![ .NET Core] ( https://github.com/chrishanzlik/ZPLForge/workflows/.NET%20Core/badge.svg?branch=master ) |
7+
8+
9+ ##### What is ZPLForge?
10+
11+ The ZPLForge library for people who do not want to deal directly with ** ZPL II** or read the
412documentation for hours. ZPLForge creates ZPL code in no time with special builders that
5- guide user in easy steps.
13+ guides the user in easy steps.
614Another advantage is the XML serialization which comes with the
715* ZPLForge.XmlSerialization* package. With this, the label is saved in XML format
816in a file or string that is easy to read and adaptable to third parties.
917
1018##### What this library is not
1119
12- This library is not about talking to printers. Not even
13- for generating GRF from bitmaps. The goal of this is to stay lightweight and
14- free of dependencies.
15-
16- #### Package infos
20+ This library is not intended to communicate with any kind of devices. Converting bitmaps into GRF
21+ is also not part of ZPLForge's responsibility. The goal is to stay lightweight and free of
22+ dependencies.
1723
18- | Package | Target framework | NuGet | CI build (master) | CI build (develop) |
19- | ----------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
20- | ** ZPLForge** | .NET Standard 2.0 | [ ![ NuGet] ( https://img.shields.io/nuget/vpre/ZPLForge.svg )] ( https://www.nuget.org/packages/ZPLForge/ ) | ![ .NET Core] ( https://github.com/chrishanzlik/ZPLForge/workflows/.NET%20Core/badge.svg?branch=master ) | ![ .NET Core] ( https://github.com/chrishanzlik/ZPLForge/workflows/.NET%20Core/badge.svg?branch=develop ) |
21- | ** ZPLForge.XmlSerialization** | .NET Standard 2.0 | [ ![ NuGet] ( https://img.shields.io/nuget/vpre/ZPLForge.XmlSerialization.svg )] ( https://www.nuget.org/packages/ZPLForge.XmlSerialization/ ) | ![ .NET Core] ( https://github.com/chrishanzlik/ZPLForge/workflows/.NET%20Core/badge.svg?branch=master ) | ![ .NET Core] ( https://github.com/chrishanzlik/ZPLForge/workflows/.NET%20Core/badge.svg?branch=develop ) |
22-
23- #### Supported label content
24+ ##### Which label elements are covered by ZPLForge?
2425- Text
2526- Ellipse
2627- Rectangle
@@ -30,11 +31,14 @@ free of dependencies.
3031- Image
3132- Diagonal Line
3233
34+ * More barcode types will be added in future versions.*
35+
3336## Label builder
34- Using the ` LabelBuilder ` is recommended, because all required properties on the labels (and its content) will be set. Additionally this brings some validation.
37+ Using the ` LabelBuilder ` is recommended way to build labels in ZPLForge, because all required properties
38+ on the label (including the childs) will be covered. Additionally this brings some validation.
3539
3640### Example
37- This example is printed on a adhesive label with a total width of 60 mm on a ZD420
41+ This example is printed on a continuous media with a total width of 60 mm on a Zebra ZD420
3842printer. This printer prints with a resolution of 203 dpi, so I calculated the total width in dots as
3943follows:
4044(60 mm / 25.4) * 203 dpi = 480 dots
@@ -43,45 +47,46 @@ follows:
4347
4448``` csharp
4549Label priceLabel = LabelBuilder
46- .FromWebSensingMedia (480 , PrintMode . TearOff , MediaType .ThermalTransfer )
50+ .FromCuttedContinuousMedia (480 , 200 , 0 , MediaType .ThermalTransfer )
4751 .SetQuantity (1 )
52+ .AdjustDarknessLevel (+ 12 )
4853 .AddText (txt => txt
49- .At (15 , 30 )
50- .SetContent (" Sweet Blue Shoes" )
51- .SetFont (Font .Default , 25 ))
54+ .At (15 , 30 )
55+ .SetContent (" Sweet Blue Shoes" )
56+ .SetFont (Font .Default , 25 ))
5257 .AddText (txt => txt
53- .At (15 , 60 )
54- .SetContent (" The Shoe Manufcaturers" )
55- .SetFont (Font .Default , 20 ))
58+ .At (15 , 60 )
59+ .SetContent (" The Shoe Manufcaturers" )
60+ .SetFont (Font .Default , 20 ))
5661 .AddSymbol (sym => sym
57- .At (215 , 60 )
58- .SetSymbol (SymbolKind .TradeMark , 10 , 10 ))
62+ .At (220 , 60 )
63+ .SetSymbol (SymbolKind .TradeMark , 10 , 10 ))
5964 .AddCode128Barcode (c128 => c128
60- .At (100 , 105 )
61- .SetHeight (50 )
62- .SetContent (" 123456789" ))
63- .AddRectangle (circle => circle
64- .At (310 , 20 )
65- .SetDimensions (165 , 60 )
66- .SetBorder (LabelColor .Black , 60 ))
65+ .At (100 , 105 )
66+ .SetHeight (50 )
67+ .SetContent (" 123456789" ))
68+ .AddRectangle (rect => rect
69+ .At (310 , 20 )
70+ .SetDimensions (165 , 60 )
71+ .SetBorder (LabelColor .Black , 60 ))
6772 .AddText (txt => txt
68- .At (310 , 35 )
69- .ApplyBlockMode (170 , 1 , BlockAlignment .Center )
70- .SetContent (" $ 49.99" )
71- .SetFont (Font .S , 20 )
72- .InvertColors ())
73+ .At (310 , 35 )
74+ .ApplyBlockMode (170 , 1 , BlockAlignment .Center )
75+ .SetContent (" $ 49.99" )
76+ .SetFont (Font .S , 20 )
77+ .InvertColors ())
7378 .AddRectangle (rect => rect
74- .At (5 , 20 )
75- .SetDimensions (470 , 170 )
76- .SetBorder (LabelColor .Black , 1 ))
79+ .At (5 , 20 )
80+ .SetDimensions (470 , 170 )
81+ .SetBorder (LabelColor .Black , 1 ))
7782 .Build ();
7883
7984string zpl = priceLabel .ToString ();
8085```
8186
8287ZPL string generated by the builder above:
8388``` zpl
84- ^XA^MNY ,0^PW480^MMT^ MTT^PQ1,0,0,N,Y^CI28^PR2,6,2^FO15,30,0^FDSweet Blue Shoes^A0,N, 25,13 ^FS^FO15,60,0^FDThe Shoe Manufcaturers^A0,N, 20,11 ^FS^FO215 ,60,0^GSN,10,10^FDC^FS^FO100,105,0^BY2,3.0,10^BCN,50,Y,N,N^FD123456789^FS^FO310,20,0^GB165,60,60,B,0^FS^FO310,35,0^FR^FD$ 49.99^AS,N, 20,11 ^FB170,1,0,C^FS^FO5,20,0^GB470,170,1,B,0^FS^XZ
89+ ^XA^LL200^MNN ,0^PW480^MMC^MD12^ MTT^PQ1,0,0,N,Y^CI28^PR2,6,2^FO15,30,0^FDSweet Blue Shoes^A0I, 25,^FS^FO15,60,0^FDThe Shoe Manufcaturers^A0N, 20,^FS^FO220 ,60,0^GSN,10,10^FDC^FS^FO100,105,0^BY2,3.0,10^BCN,50,Y,N,N^FD123456789^FS^FO310,20,0^GB165,60,60,B,0^FS^FO310,35,0^FR^FD$ 49.99^ASN, 20,^FB170,1,0,C^FS^FO5,20,0^GB470,170,1,B,0^FS^XZ
8590```
8691
8792The printed label:
@@ -90,21 +95,21 @@ The printed label:
9095
9196### Factory methods
9297
93- Depending on the label which is inserted, choose one of the factory methods below to create a ` LabelBuilder ` instance.
98+ Depending on the medium what is inserted into the printer , choose one of the factory methods below to create a ` LabelBuilder ` instance:
9499
95100``` csharp
96101LabelBuilder .FromWebSensingMedia (int printWidth , PrintMode ? printMode = null , MediaType ? mediaType = null );
97102
98103LabelBuilder .FromContinuousMedia (int printWidth , int labelLength , PrintMode ? printMode = null , MediaType ? mediaType = null );
99104
100- LabelBuilder .FromCuttedContinuousMedia (int printWidth , int labelLength , MediaType ? mediaType = null );
105+ LabelBuilder .FromCuttedContinuousMedia (int printWidth , int labelLength , int groupCutCount = 0 , MediaType ? mediaType = null );
101106
102107LabelBuilder .FromBlackMarkSensingMedia (int printWidth , int blackMarkOffset , PrintMode ? printMode = null , MediaType ? mediaType = null );
103108```
104109
105110### Builder Extensibility
106111
107- All builders can be extended with normal C# extension methods:
112+ All builders are extendable by common C# extension methods:
108113
109114``` csharp
110115public static class BuilderExtensions
@@ -130,13 +135,16 @@ This would make it possible to create your own builders.
130135Label priceLabel = new Label {
131136 Quantity = 1 ,
132137 PrintWidth = 480 ,
138+ MediaTracking = MediaTracking .Continuous ,
139+ MediaType = MediaType .ThermalTransfer ,
140+ PrintMode = PrintMode .Cutter ,
141+ MediaDarknessLevel = 12 ,
133142 Content = {
134143 new TextElement {
135144 PositionX = 15 ,
136145 PositionY = 15 ,
137146 Content = " Sweet Blue Shoes" ,
138- CharHeight = 25 ,
139- CharWidth = (int )(25 / 1 . 8 )
147+ CharHeight = 25
140148 },
141149 new BarcodeElement {
142150 BarcodeType = BarcodeType .Code128
@@ -165,18 +173,18 @@ This will output the `Label` and its content in easy to read (and editable) XML
165173
166174``` xml
167175<?xml version =" 1.0" ?>
168- <Label version =" 0. 1.0-beta " >
169- <MediaTracking >WebSensing </MediaTracking >
176+ <Label version =" 1.0.0 " >
177+ <MediaTracking >Continuous </MediaTracking >
170178 <PrintWidth >480</PrintWidth >
171- <PrintMode >TearOff </PrintMode >
179+ <PrintMode >Cutter </PrintMode >
172180 <MediaType >ThermalTransfer</MediaType >
181+ <MediaDarknessLevel >12</MediaDarknessLevel >
173182 <Content >
174183 <Text >
175184 <PositionX >15</PositionX >
176185 <PositionY >30</PositionY >
177186 <Content >Sweet Blue Shoes</Content >
178187 <CharHeight >25</CharHeight >
179- <CharWidth >13</CharWidth >
180188 </Text >
181189 <Symbol >
182190 <PositionX >215</PositionX >
@@ -196,16 +204,17 @@ This will output the `Label` and its content in easy to read (and editable) XML
196204</Label >
197205```
198206
199- To serialize default values (disabled by default) use the ` serializeDefaults `
200- parameter on ` LabelXmlSerializer ` :
207+ For serializing default values (disabled by default) set the ` serializeDefaults `
208+ parameter on ` LabelXmlSerializer ` to ` true ` :
201209
202210```
203211serializer.Serialize(fileStream, priceLabel, serializeDefaults: true);
204212```
205213
206214### Deserialization
207215
208- To consume such label XML files, we use the ` LabelXmlSerializer ` again:
216+ The generated XML file above can be deserialized back into the ` Label ` object
217+ with the ` LabelXmlSerializer ` again:
209218
210219``` csharp
211220using var fileStream = File .OpenRead (" priceLabel.xml" );
0 commit comments