Skip to content

Commit d6b7903

Browse files
primo-ppcgYipingRuandependabot[bot]egakupireportingissue
committed
Merge develop branch (#232)
* Create dotnet - test.yml * Bump SkiaSharp from 2.88.3 to 2.88.6 in /src/BinaryKits.Zpl.Viewer Bumps [SkiaSharp](https://github.com/mono/SkiaSharp) from 2.88.3 to 2.88.6. - [Release notes](https://github.com/mono/SkiaSharp/releases) - [Commits](mono/SkiaSharp@v2.88.3...v2.88.6) --- updated-dependencies: - dependency-name: SkiaSharp dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * fix(viewer): cannot find package vue@next (#208) * fix(viewer): cannot find package vue@next * Update index.html Don't use specific versions for web dependencies. * Enable ^FV command (needed for UPS) (#195) * Enable ^FV command - Based off ^FD * ZPL Parser: Enable ignoring certain commands (#194) * Enable ignoring certain commands - small refactors + comments in the zpl parser * Comment specification * Add documentation on how to add barcode support (#198) * Change invertdraw to skia xor blending (#193) - Also added tests - Refactored viewer tests * Structure Viewer UnitTest project (merge after #193) (#199) * Change invertdraw to skia xor blending - Also added tests - Refactored viewer tests * Begin structuring viewer testing project - readme for goals - custom test for feature development - zpl/png data folder copied to output - factor out more to common * Try to fix cannot copy data to output for linux build * Copy data again * Capitalization mistake * Added: Font fallback structure for the default fonts. (#217) * Added: Font fallback structure for the default fonts. * Improved: DejaVu Sans Mono as first mono type Improved: Courier New is more often available than Courier * Added: Roboto font to Dockerfile * Improved: Enabled antialiased text (#218) * Improved: Barcode scaling for PDF417 and Code128 (#219) * Improved: Code128 charset usage Improved: PDF417 scaling Improved: DHL uses a decimal height for PDF417 Improved: PDF417 size when no column value is given * Improved: PDF417 uses correct vertical scaling now * Improved: GS1 type support Improved: Code128 invocation filtering * Added: PDF generation (#220) * Added: Font fallback structure for the default fonts. * Improved: DejaVu Sans Mono as first mono type Improved: Courier New is more often available than Courier * Improved: Enabled antialiased text * Improved: Code128 charset usage Improved: PDF417 scaling Improved: DHL uses a decimal height for PDF417 Improved: PDF417 size when no column value is given * Added: Roboto fontface to docker image * Improved: Added a working roboto font to the Dockerfile * Improved: PDF417 uses correct vertical scaling now * Added: PDF support Added: Download buttons for ZPL, PNG and PDF Fixed: GraphicBox radius with thicker lines Improved: Invert/Reverse draw results when using white elements Improved: White background for PNG requested from viewer * Added: More real world tests Improved: Tabs for tests and examples in webinterface * Improved: GraphicBox can't have a border smaller than 1 * Improved: Made more ^FR blending native for performance * Improved: GraphicBox border should not exceed half of the smallest side. Improved: Adjusted some example sizes * Fixed: Build issues * Improved: More Skia blending to improve performance Improved: Performance of GraphicBox rounding fix Added: GraphicCircle supports reverse draw now Improved: Overlay can handle custom label sizes better now * Improved: Overlay requests may use wrong number formatting * Bump Dependencies Bump ImageSharp and SkiaSharp dependencies. * Added: MaxiCode support (#224) * Added: MaxiCode support * Improved: Slight finetune on maxicode linux fix * Patch #194 (#227) Don't neglect to append on ignore. * Added: Barcode93 support (#226) * Added: Barcode93 support * Update Code93 Update interpretation line Add test to WebApi * Fix vue lib URL (#228) * Drop BarcodeLib dependency (#229) * Drop BarcodeLib dependency * don't inline regex * Prepare for release * Silence warnings --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Yiping <YipingRuan@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Dmitrii Savchenkov <dmisavchenkv@gmail.com> Co-authored-by: reportingissue <136993729+reportingissue@users.noreply.github.com> Co-authored-by: Daniël van der Garde <12891775+daanggc@users.noreply.github.com> Co-authored-by: Marius Starke <72494359+marius-arch@users.noreply.github.com> Co-authored-by: Yiping <kookaburracc@msn.com>
1 parent 056aeae commit d6b7903

File tree

84 files changed

+3028
-520
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+3028
-520
lines changed

.github/workflows/dotnet - test.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: .NET
2+
3+
on:
4+
push:
5+
branches: [ develop ]
6+
pull_request:
7+
branches: [ develop ]
8+
9+
jobs:
10+
build-windows:
11+
12+
runs-on: windows-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Setup .NET 6.0
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 6.0.x
20+
- name: Restore dependencies
21+
working-directory: ./src
22+
run: dotnet restore
23+
- name: Build
24+
working-directory: ./src
25+
run: dotnet build --configuration Release --no-restore /p:NoWarn=1591
26+
- name: Test
27+
working-directory: ./src
28+
run: dotnet test --configuration Release --no-restore --no-build --verbosity normal
29+
30+
build-linux:
31+
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- uses: actions/checkout@v2
36+
- name: Setup .NET 6.0
37+
uses: actions/setup-dotnet@v1
38+
with:
39+
dotnet-version: 6.0.x
40+
- name: Restore dependencies
41+
working-directory: ./src
42+
run: dotnet restore
43+
- name: Build
44+
working-directory: ./src
45+
run: dotnet build --configuration Release --no-restore /p:NoWarn=1591
46+
- name: Test
47+
working-directory: ./src
48+
run: dotnet test --configuration Release --no-restore --no-build --verbosity normal
49+
50+

src/BinaryKits.Zpl.Label.UnitTest/BarcodeTest.cs

+16
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ public void Barcode39()
2424
Assert.AreEqual("^XA\n^LH0,0\n^CI28\n\n^FO100,100\n^BY2,3\n^B3N,N,100,Y,N\n^FD123ABC^FS\n^XZ", output);
2525
}
2626

27+
[TestMethod]
28+
public void Barcode93()
29+
{
30+
var elements = new List<ZplElementBase>
31+
{
32+
new ZplBarcode93("123ABC", 100, 300)
33+
};
34+
35+
var renderEngine = new ZplEngine(elements);
36+
var output = renderEngine.ToZplString(new ZplRenderOptions { AddEmptyLineBeforeElementStart = true });
37+
38+
Debug.WriteLine(output);
39+
Assert.IsNotNull(output);
40+
Assert.AreEqual("^XA\n^LH0,0\n^CI28\n\n^FO100,300\n^BY2,3\n^BAN,100,Y,N,N\n^FD123ABC^FS\n^XZ", output);
41+
}
42+
2743
[TestMethod]
2844
public void Barcode128()
2945
{

src/BinaryKits.Zpl.Label/BinaryKits.Zpl.Label.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFrameworks>net472;netstandard2.0;net6.0</TargetFrameworks>
55
<Description>This package allows you to simply and reliably prepare labels complying with the Zebra programming language, using predefined class/typing. It also supports you with image conversion.</Description>
66
<Company>Binary Kits Pte. Ltd.</Company>
7-
<Version>3.1.5</Version>
7+
<Version>3.2.0</Version>
88
<Authors>Binary Kits Pte. Ltd.</Authors>
99
<PackageReleaseNotes></PackageReleaseNotes>
1010
<PackageTags>Zebra ZPL ZPL2 Printer Label</PackageTags>
@@ -23,7 +23,7 @@
2323

2424
<ItemGroup>
2525
<PackageReference Include="SixLabors.ImageSharp">
26-
<Version>2.1.3</Version>
26+
<Version>2.1.8</Version>
2727
</PackageReference>
2828
</ItemGroup>
2929

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
using System.Collections.Generic;
2+
3+
namespace BinaryKits.Zpl.Label.Elements
4+
{
5+
/// <summary>
6+
/// Code 93 Barcode
7+
/// </summary>
8+
public class ZplBarcode93 : ZplBarcode
9+
{
10+
public bool CheckDigit { get; private set; }
11+
12+
/// <summary>
13+
/// Code 93 Barcode
14+
/// </summary>
15+
/// <param name="content"></param>
16+
/// <param name="positionX"></param>
17+
/// <param name="positionY"></param>
18+
/// <param name="height"></param>
19+
/// <param name="moduleWidth"></param>
20+
/// <param name="wideBarToNarrowBarWidthRatio"></param>
21+
/// <param name="fieldOrientation"></param>
22+
/// <param name="printInterpretationLine"></param>
23+
/// <param name="printInterpretationLineAboveCode"></param>
24+
/// <param name="bottomToTop"></param>
25+
/// <param name="checkDigit"></param>
26+
public ZplBarcode93(
27+
string content,
28+
int positionX,
29+
int positionY,
30+
int height = 100,
31+
int moduleWidth = 2,
32+
double wideBarToNarrowBarWidthRatio = 3,
33+
FieldOrientation fieldOrientation = FieldOrientation.Normal,
34+
bool printInterpretationLine = true,
35+
bool printInterpretationLineAboveCode = false,
36+
bool checkDigit = false,
37+
bool bottomToTop = false)
38+
: base(content,
39+
positionX,
40+
positionY,
41+
height,
42+
moduleWidth,
43+
wideBarToNarrowBarWidthRatio,
44+
fieldOrientation,
45+
printInterpretationLine,
46+
printInterpretationLineAboveCode,
47+
bottomToTop)
48+
{
49+
this.CheckDigit = checkDigit;
50+
}
51+
52+
///<inheritdoc/>
53+
public override IEnumerable<string> Render(ZplRenderOptions context)
54+
{
55+
//TODO:Add 'mode'
56+
57+
//^FO100,100 ^ BY3
58+
//^BAN,100,Y,N,N
59+
//^FD123456 ^ FS
60+
var result = new List<string>();
61+
result.AddRange(RenderPosition(context));
62+
result.Add(RenderModuleWidth());
63+
result.Add($"^BA{RenderFieldOrientation()},{context.Scale(Height)},{RenderPrintInterpretationLine()},{RenderPrintInterpretationLineAboveCode()},{(CheckDigit ? "Y" : "N")}");
64+
result.Add($"^FD{Content}^FS");
65+
66+
return result;
67+
}
68+
}
69+
}

src/BinaryKits.Zpl.Label/Elements/ZplGraphicCircle.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ public ZplGraphicCircle(
2424
int diameter,
2525
int borderThickness = 1,
2626
LineColor lineColor = LineColor.Black,
27+
bool reversePrint = false,
2728
bool bottomToTop = false)
28-
: base(positionX, positionY, borderThickness, lineColor, bottomToTop: bottomToTop)
29+
: base(positionX, positionY, borderThickness, lineColor, reversePrint, bottomToTop)
2930
{
3031
Diameter = diameter;
3132
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
using System.Collections.Generic;
2+
using System.Text;
3+
4+
namespace BinaryKits.Zpl.Label.Elements
5+
{
6+
public class ZplMaxiCode : ZplPositionedElementBase, IFormatElement
7+
{
8+
public string Content { get; protected set; }
9+
10+
public int Mode { get; private set; }
11+
12+
public int Position { get; private set; }
13+
14+
public int Total { get; private set; }
15+
16+
public bool UseHexadecimalIndicator { get; protected set; }
17+
18+
/// <summary>
19+
/// Zpl QrCode
20+
/// </summary>
21+
/// <param name="content"></param>
22+
/// <param name="positionX"></param>
23+
/// <param name="positionY"></param>
24+
/// <param name="mode">2 (numeric postal code) Default, 3 (alphanumeric postal code), 4 (standard), 5 (full EEC), and 6 (reader programming)</param>
25+
/// <param name="position">1-8, (default: 1)</param>
26+
/// <param name="total">1-8, (default: 1)</param>
27+
/// <param name="useHexadecimalIndicator"></param>
28+
/// <param name="bottomToTop"></param>
29+
public ZplMaxiCode(
30+
string content,
31+
int positionX,
32+
int positionY,
33+
int mode = 2,
34+
int position = 1,
35+
int total = 1,
36+
bool useHexadecimalIndicator = false,
37+
bool bottomToTop = false)
38+
: base(positionX, positionY, bottomToTop)
39+
{
40+
Content = content;
41+
Mode = mode;
42+
Position = position;
43+
Total = total;
44+
UseHexadecimalIndicator = useHexadecimalIndicator;
45+
}
46+
47+
///<inheritdoc/>
48+
public override IEnumerable<string> Render(ZplRenderOptions context)
49+
{
50+
//^FO100,100
51+
//^BD2,1,1
52+
//^FH^FD002840100450000_5B)>_1E01_1D961Z00136071_1DUPSN_1D123X56_1D028_1D_1D001/001_1D011_1DN_1D_1DNEW YORK_1DNY_1E_04^FS
53+
var result = new List<string>();
54+
result.AddRange(RenderPosition(context));
55+
result.Add($"^BD{Mode},{Position},{Total}");
56+
result.Add(RenderFieldDataSection());
57+
58+
return result;
59+
}
60+
61+
protected string RenderFieldDataSection()
62+
{
63+
var sb = new StringBuilder();
64+
if (UseHexadecimalIndicator)
65+
{
66+
sb.Append("^FH");
67+
}
68+
69+
if (Content != null)
70+
{
71+
sb.Append("^FD");
72+
sb.Append(Content);
73+
sb.Append("^FS");
74+
}
75+
76+
return sb.ToString();
77+
}
78+
79+
/// <inheritdoc />
80+
public void SetTemplateContent(string content)
81+
{
82+
Content = content;
83+
}
84+
}
85+
}

src/BinaryKits.Zpl.Label/Elements/ZplPDF417.cs

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class ZplPDF417 : ZplPositionedElementBase, IFormatElement
99
{
1010

1111
public int Height { get; protected set; }
12+
public int ModuleWidth { get; protected set; }
1213
public string Content { get; protected set; }
1314
public FieldOrientation FieldOrientation { get; protected set; }
1415
public int? Columns { get; protected set; }
@@ -23,6 +24,7 @@ public class ZplPDF417 : ZplPositionedElementBase, IFormatElement
2324
/// <param name="positionX"></param>
2425
/// <param name="positionY"></param>
2526
/// <param name="height"></param>
27+
/// <param name="moduleWidth"></param>
2628
/// <param name="columns">1-30: Number of data columns to encode. Default will auto balance 1:2 row to column</param>
2729
/// <param name="rows">3-90. Number of data columns to encode. Default will auto balance 1:2 row to column</param>
2830
/// <param name="compact">Truncate right row indicators and stop pattern</param>
@@ -34,6 +36,7 @@ public ZplPDF417(
3436
int positionX,
3537
int positionY,
3638
int height = 8,
39+
int moduleWidth = 2,
3740
int? columns = null,
3841
int? rows = null,
3942
bool compact = false,
@@ -45,6 +48,7 @@ public ZplPDF417(
4548
{
4649
FieldOrientation = fieldOrientation;
4750
Height = height;
51+
ModuleWidth = moduleWidth;
4852
Columns = columns;
4953
Rows = rows;
5054
Compact = compact;

src/BinaryKits.Zpl.Labelary/BinaryKits.Zpl.Labelary.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFrameworks>netstandard2.1</TargetFrameworks>
55
<Description>This package provides a client for the Labelary API for rendering ZPL data</Description>
66
<Company>Binary Kits Pte. Ltd.</Company>
7-
<Version>1.0.1</Version>
7+
<Version>1.0.2</Version>
88
<Authors>Binary Kits Pte. Ltd.</Authors>
99
<PackageReleaseNotes></PackageReleaseNotes>
1010
<PackageTags>Zebra ZPL ZPL2 ZPLEmulator ZPLVirtualPrinter ZPLViewer Labelary</PackageTags>

src/BinaryKits.Zpl.Labelary/LabelSize.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public double WidthInInch
2525
return _width;
2626
}
2727

28-
return Math.Round(_width / _millimeterToInch, 0);
28+
var rounded = Math.Round(_width / _millimeterToInch, 8);
29+
return rounded;
2930
}
3031
}
3132

@@ -37,8 +38,9 @@ public double HeightInInch
3738
{
3839
return _height;
3940
}
40-
41-
return Math.Round(_height / _millimeterToInch, 0);
41+
42+
var rounded = Math.Round(_height / _millimeterToInch, 8);
43+
return rounded;
4244
}
4345
}
4446
}

src/BinaryKits.Zpl.Labelary/LabelaryClient.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Microsoft.Extensions.Logging;
22
using System;
3+
using System.Globalization;
34
using System.Net.Http;
45
using System.Text;
56
using System.Threading.Tasks;
@@ -42,9 +43,15 @@ public async Task<byte[]> GetPreviewAsync(
4243
{
4344
var dpi = printDensity.ToString().Substring(2);
4445
var zpl = Encoding.UTF8.GetBytes(zplData);
46+
47+
//without setting this, a comma separator might be used for for the size numbers in the URL
48+
var specifier = "G";
49+
var culture = CultureInfo.CreateSpecificCulture("en-US");
50+
var width = labelSize.WidthInInch.ToString(specifier, culture);
51+
var height = labelSize.HeightInInch.ToString(specifier, culture);
4552

4653
using var byteContent = new ByteArrayContent(zpl);
47-
using (var response = await _httpClient.PostAsync($"{_apiEndpoint}/{dpi}/labels/{labelSize.WidthInInch}x{labelSize.HeightInInch}/0/", byteContent))
54+
using (var response = await _httpClient.PostAsync($"{_apiEndpoint}/{dpi}/labels/{width}x{height}/0/", byteContent))
4855
{
4956
if (!response.IsSuccessStatusCode)
5057
{

src/BinaryKits.Zpl.Protocol/BinaryKits.Zpl.Protocol.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFrameworks>net472;netstandard2.0;net6.0</TargetFrameworks>
55
<Description>This package contains the zebra protocol of the Zebra Programming Language. It also supports you with image conversion.</Description>
66
<Company>Binary Kits Pte. Ltd.</Company>
7-
<Version>1.0.0</Version>
7+
<Version>1.0.1</Version>
88
<Authors>Binary Kits Pte. Ltd.</Authors>
99
<PackageReleaseNotes></PackageReleaseNotes>
1010
<PackageTags>Zebra ZPL ZPL2 Printer Protocol</PackageTags>
@@ -23,7 +23,7 @@
2323

2424
<ItemGroup>
2525
<PackageReference Include="SixLabors.ImageSharp">
26-
<Version>1.0.4</Version>
26+
<Version>2.1.8</Version>
2727
</PackageReference>
2828
</ItemGroup>
2929

0 commit comments

Comments
 (0)