ThermalLabel SDK for .NET Maintenance Update – Version 16.0.26.1117: RTL rendering, Barcode patterns, Cutter and Batch Label
ThermalLabel SDK for .NET version 16.0.26.1117 ships with the following main fixes and improvements:
Better Right-to-Left Text Rendering
This update reworks how ThermalLabel SDK lays out bidirectional text: Arabic, Hebrew and other RTL scripts, alone or mixed with Latin text and numbers. Text now renders in the order readers expect, whether it comes as plain text, HTML or RTF.
Improvements:
- Accurate RTL alignment: RTL lines that include digits or Latin words stay within the item and align correctly, even in narrow items.
- Line breaks in RTL text: Explicit line breaks (\n, \r\n) now produce separate, correctly ordered lines.
- RTF and HTML with RTL: Formatted text, for example RTF from a RichTextBox, renders cleanly with
RightToLeft = true. - Mixed-direction text in LTR items: A Latin product code next to an Arabic description now keeps its natural reading order.
- Inline RTL spans in HTML: A
<span dir="rtl">inside an LTR line renders inline, just like in a web browser.
For example, a bilingual label line now renders as expected:
var txt = new TextItem
{
X = 0.2, Y = 0.2, Width = 3.5, Height = 0.4,
Text = "<html>Lot 42 – <span dir=\"rtl\">الشركة الوطنية</span></html>"
};
Fix: barcode format patterns with FitProportional sizing
This update fixes a bug in BarcodeItem that affected barcodes using Sizing = BarcodeSizing.FitProportional together with CodeFormatPattern or TextFormatPattern. In that combination the pattern was applied twice:
var b = new BarcodeItem(5, 3, 60, 18, BarcodeSymbology.Code128, "123")
{
Sizing = BarcodeSizing.FitProportional,
CodeFormatPattern = "AB{0}"
};
// Before: encoded and displayed "ABAB123"
// Now: encoded and displayed "AB123"
Because of this, the barcode could encode the wrong value and come out wider than its item, with the right edge cut off. The bug affected the preview, image export and printer commands such as ZPL and EPL. The None, Fill and AutoSize sizing modes worked correctly and still do.
New! Batch cutting now works on EPL and Fingerprint printers
Before this update, BatchCut only worked on ZPL printers. Now it also works on EPL and Fingerprint/Direct Protocol printers. You can tell the cutter to cut after every N labels, so labels come out in ready-to-use strips. Setup is the same for all three languages:
var tl = new ThermalLabel(UnitType.Inch, 4, 3);
// ...add your items...
tl.CutAfterPrinting = true;
tl.BatchCut = 3; // cut after every 3 labels
using (var pj = new PrintJob())
{
pj.ProgrammingLanguage = ProgrammingLanguage.EPL; // also ZPL, Fingerprint, DirectProtocol
pj.Copies = 6;
pj.ThermalLabel = tl;
var commands = pj.GetNativePrinterCommands();
}
This prints 6 labels in two strips of 3, with a cut after each strip.
Heads-up for EPL and Fingerprint users: with CutAfterPrinting turned on and the default BatchCut = 1, the printer now cuts after every label, as ZPL already did. To keep the old behavior of a single cut at the end of the job, set BatchCut = 0.
Cutter support when printing as graphic
When a printer isn't natively supported by the SDK, PrintAsGraphic sends each label as an image through its Windows driver. Paper size and duplex already worked that way, but cutting didn't, because each manufacturer keeps its cutter options in the driver's private settings. This update fills that gap:
- Saved driver settings:
WindowsPrintJob.DriverSettingstakes driver settings (DEVMODE) that you capture once and store. The SDK applies them on every print, including options it doesn't expose itself, such as cutter, media type or darkness. - Batch cutting:
PrintAsGraphicnow supportsThermalLabel.CutAfterPrintingandBatchCut. It sends one spooler job every N labels, so a driver set to "cut at end of job" cuts after every batch, whatever the printer brand.
// Once: let the user configure the cutter in the driver dialog, then store the result
byte[] driverSettings = WindowsPrintJob.ShowDriverSettingsDialog("My Cutter Printer", this.Handle);
// When printing
using (var job = new WindowsPrintJob(printerSettings))
{
job.DriverSettings = driverSettings;
label.CutAfterPrinting = true;
label.BatchCut = 5; // cut every 5 labels
job.PrintAsGraphic(label);
}
Use WindowsPrintJob.GetDriverSettings(printerName) to read the printer's current settings without showing a dialog.
Cutter settings now apply correctly in the Thermal Label Editor
In this update, UpdateLabelDocument(LabelDocument) applies all print settings: CutAfterPrinting, PrintMirror, PrintSpeed and Darkness. Before, these values were ignored, so a call that changed only them did nothing. We also fixed PrintMirror being lost after loading and saving a label again.
LabelDocument also has a new BatchCut property, so you can choose how many labels to print before each cut. It stays in sync with ThermalLabel.BatchCut and works with undo/redo.
var doc = new LabelDocument();
doc.UpdateFrom(thermalLabelEditor1.LabelDocument); // start from the current settings
doc.CutAfterPrinting = true;
doc.BatchCut = 5; // cut after every 5 labels
thermalLabelEditor1.UpdateLabelDocument(doc);
How to update
- Visual Studio: right-click your project → Manage NuGet Packages → Updates, select the SDK package and click Update. Or from the command line:
dotnet add package <PackageId>. Then do a Clean + Rebuild. - VS Code: open the integrated terminal and run
dotnet add package <PackageId>, then rebuild. With the C# Dev Kit extension you can also use the Command Palette → NuGet: Update NuGet Package.
More information
- Full release notes: version history
- Quick Start and API reference: ThermalLabel SDK for .NET
| Tweet |
|