LabelPrinter 1.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package LabelPrinter --version 1.2.1
                    
NuGet\Install-Package LabelPrinter -Version 1.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LabelPrinter" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LabelPrinter" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="LabelPrinter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LabelPrinter --version 1.2.1
                    
#r "nuget: LabelPrinter, 1.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LabelPrinter@1.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LabelPrinter&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=LabelPrinter&version=1.2.1
                    
Install as a Cake Tool

集成 CS6、CS7、BarTender10 的标签打印库

其中 CodeSoft 系列支持追加页打印,打印更快。 示例:


 using LabelPrinter;
 using System.Diagnostics;
 
 Console.WriteLine("开始打印测试!");
 
 Stopwatch stopwatch = Stopwatch.StartNew();
 
 LabelApp.IsOldLableFunc(() => false);
 
 LabelApp.SetOpenTimeout(1000);
 LabelApp.SetQuitTimeout(1000);

 var labelApp = await LabelApp.GetApp(AppType.Lab);
 
 Console.WriteLine($"创建耗时:{stopwatch.ElapsedMilliseconds / 1000.00}s");
 if (labelApp.IsInstalled)
 {
     await Test(labelApp);
 }
 
 Console.WriteLine($"累计耗时:{stopwatch.ElapsedMilliseconds / 1000.00}s");
 Console.ReadKey(true);
 
 static async Task Test(ILabelApp labelApp)
 {
     using CancellationTokenSource source = new();
     try
     {
         string path = labelApp.Type is AppType.Btw ? $"{Environment.CurrentDirectory}\\文档1.btw" : $"{Environment.CurrentDirectory}\\文档1.lab";
 
         await using var format = await labelApp.OpenPrint(path, source.Token);
 
         for (int i = 0; i < 1000; i++)
         {
             try
             {
                 await format.SetVariable("Key", i.ToString(), source.Token);
                 //await format.SetVariable("没有", "123987");
                 await format.PrintLabel(1, source.Token).WaitAsync(TimeSpan.FromSeconds(5));
 
                 //await format.PrintDocumentWait(() =>
                 //{
                 //    return false;
                 //}, 1);
 
                 short free = await format.FormFeed(source.Token);
                 Console.WriteLine($"累计打印:{i + 1}次");
             }
             catch (Exception ex)
             {
                 if (ex.Message is "远程过程调用失败。 (0x800706BE)")
                 {
                     await format.Reset(source.Token);
                     i--;
                     continue;
                 }
                 throw;
             }
         }
     }
     catch (Exception)
     {
         source.Cancel();
     }
 }

本库由 Nixue 提供并持续维护

Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed.  net9.0-windows was computed.  net10.0-windows was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6.1

    • No dependencies.
  • net6.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.9 121 8/22/2026
1.3.6 117 7/20/2026
1.3.0 317 12/15/2025
1.2.8 485 12/9/2025
1.2.3 448 11/19/2025
1.2.2 441 11/19/2025
1.2.1 440 11/18/2025
1.1.8 313 11/14/2025
1.1.5 321 11/14/2025
1.1.2 323 11/13/2025
1.0.7 212 10/31/2025
1.0.5 240 10/29/2025
1.0.3 240 10/28/2025
1.0.2 230 10/28/2025
1.0.0 246 10/28/2025

CodeSoft6+ BarTender10 支持的统一调用库