SoftekBarcodeNet 9.4.1.1
dotnet add package SoftekBarcodeNet --version 9.4.1.1
NuGet\Install-Package SoftekBarcodeNet -Version 9.4.1.1
<PackageReference Include="SoftekBarcodeNet" Version="9.4.1.1" />
<PackageVersion Include="SoftekBarcodeNet" Version="9.4.1.1" />
<PackageReference Include="SoftekBarcodeNet" />
paket add SoftekBarcodeNet --version 9.4.1.1
#r "nuget: SoftekBarcodeNet, 9.4.1.1"
#:package SoftekBarcodeNet@9.4.1.1
#addin nuget:?package=SoftekBarcodeNet&version=9.4.1.1
#tool nuget:?package=SoftekBarcodeNet&version=9.4.1.1
Softek Barcode Reader Toolkit for Windows Copyright Softek Software Ltd 2002-2024
This is a .NET Framework 4.0 package that reads barcodes from JPG, TIF and PDF format data or bitmaps held in memory.
Full documentation for the SDK can be downloaded from:
http://softeksoftware.co.uk/download/barcode_sdk/documentation.pdf
Support and trial license email: nuget@bardecode.com
Basic use:
barcode = new SoftekBarcodeNet.BarcodeReader(); nBarCode = barcode.ScanBarCode("inputfile.pdf"); // Can be TIF, BMP, JPG or PDF
for (int i = 1; i ⇐ nBarCode; i++) value = barcode.GetBarString(i);
Setting more options and getting more results:
using (barcode = new SoftekBarcodeNet.BarcodeReader()) {
// Enter your license key here // You can get a trial license key from nuget@bardecode.com // Example: // barcode.LicenseKey = "MY LICENSE KEY";
// Turn on the barcode types you want to read. // Turn off the barcode types you don't want to read (this will increase the speed of your application) barcode.ReadCode128 = true; barcode.ReadCode39 = true; barcode.ReadCode25 = true; barcode.ReadEAN13 = true; barcode.ReadEAN8 = true; barcode.ReadUPCA = true; barcode.ReadUPCE = true; barcode.ReadCodabar = false; barcode.ReadPDF417 = true; barcode.ReadDataMatrix = true; barcode.ReadDatabar = true; barcode.ReadMicroPDF417 = false; barcode.ReadQRCode = true;
// Databar Options is a mask that controls which type of databar barcodes will be read and whether or not // the software will look for a quiet zone around the barcode. // 1 = 2D-Linkage flag (handle micro-PDf417 barcodes as supplementary data - requires ReadMicroPDF417 to be true). // 2 = Read RSS14 // 4 = Read RSS14 Stacked // 8 = Read Limited // 16 = Read Expanded // 32 = Read Expanded Stacked // 64 = Require quiet zone barcode.DatabarOptions = 255;
// If you want to read more than one barcode then set Multiple Read to 1 // Setting MutlipleRead to False will make the recognition faster barcode.MultipleRead = true;
// Noise reduction takes longer but can make it possible to read some difficult barcodes // When using noise reduction a typical value is 10 - the smaller the value the more effect it has. // A zero value turns off noise reduction. // barcode.NoiseReduction = 0 ;
// You may need to set a small quiet zone if your barcodes are close to text and pictures in the image. // A value of zero uses the default. barcode.QuietZoneSize = 0;
// LineJump controls the frequency at which scan lines in an image are sampled. // The default is 9 - decrease this for difficult barcodes. barcode.LineJump = 1;
// You can restrict your search to a particular area of the image if you wish. // This example limits the search to the upper half of the page // System.Drawing.Rectangle scanArea = new System.Drawing.Rectangle(0, 0, 100, 50); // barcode.SetScanRect(scanArea, 1);
// Set the direction that the barcode reader should scan for barcodes // The value is a mask where 1 = Left to Right, 2 = Top to Bottom, 4 = Right To Left, 8 = Bottom to Top barcode.ScanDirection = 15;
// DeskewMode controls the way in which the toolkit handles skewed documents. At the default level (2) // the toolkit will deskew at the main angle of the whole image. If the bar code is at a different angle // to the rest of the image then try 3. For more complex images try values from 4 to 6. barcode.DeskewMode = 2;
// ColorProcessingLevel controls how much time the toolkit will searching a color image for a barcode. // The default value is 2 and the range of values is 0 to 5. If ColorThreshold is non-zero then // ColorProcessingLevel is effectively set to 0. barcode.ColorProcessingLevel = 2;
// MaxLength and MinLength can be used to specify the number of characters you expect to // find in a barcode. This can be useful to increase accuracy or if you wish to ignore some // barcodes in an image. barcode.MinLength = 4; barcode.MaxLength = 999;
// When the toolkit scans an image it records the score it gets for each barcode that // MIGHT be in the image. If the scores recorded for any of the barcodes are >= PrefOccurrence // then only these barcodes are returned. Otherwise, any barcode whose scores are >= MinOccurrence // are reported. If you have a very poor quality image then try setting MinOccurrence to 1, but you // may find that some false positive results are returned. // barcode.MinOccurrence = 2 ; // barcode.PrefOccurrence = 4 ;
// Flags for handling PDF files // PdfImageOnly defaults to true and indicates that the PDF documents are simple images. barcode.PdfImageOnly = true;
// The PdfImageExtractOptions mask controls how images are removed from PDF documents (when PdfImageOnly is True) // 1 = Enable fast extraction // 2 = Auto-invert black and white images // 4 = Auto-merge strips // 8 = Auto-correct photometric values in black and white images barcode.PdfImageExtractOptions = 15;
// The PdfImageRasterOptions mask controls how images are rasterized when PdfImageOnly is false or when image extraction fails // 1 = Use alternative pdf-to-tif conversion function // 2 = Always use pdf-to-tif conversion rather than loading the rasterized image directly into memory barcode.PdfImageRasterOptions = 0;
// PdfDpi and PdfBpp control what sort of image the PDF document is rasterized into barcode.PdfDpi = 300; barcode.PdfBpp = 8;
int nBarCode;
if (CheckBitmap.Checked) { if (FilePath.Text.EndsWith(".pdf", System.StringComparison.CurrentCultureIgnoreCase)) { Console.WriteLine("Cannot load PDF files into bitmaps"); return; } System.Drawing.Bitmap bm = new System.Drawing.Bitmap("inputfile.jpg"); Console.WriteLine ("Loading image into a bitmap and calling ScanBarCodeFromBitmap"); nBarCode = barcode.ScanBarCodeFromBitmap(bm); bm.Dispose(); } else { nBarCode = barcode.ScanBarCode("inputfile.pdf"); // Can be TIF, BMP, JPG or PDF
// Or load into a byte array and use ScanBarCodeFromByteArray
// byte[] b = File.ReadAllBytes("inputfile.pdf"); // Can be TIF, BMP, JPG or PDF
// nBarCode = barcode.ScanBarCodeFromByteArray(b);
}
if (nBarCode ⇐ -6) { Result.Text += "License key error: either an evaluation key has expired or the license key is not valid for processing pdf documents\r\n"; } else if (nBarCode < 0) { Console.Write("ScanBarCode returned error number "); Console.Write(nBarCode); Console.Write("\r\n"); Console.Write("Last Softek Error Number = "); Console.Write(barcode.GetLastError()); Console.Write("\r\n"); Console.Write("Last Windows Error Number = "); Console.Write(barcode.GetLastWinError()); Console.Write("\r\n"); } else if (nBarCode == 0) { Console.WriteLine("No barcode found on this image"); } else { for (int i = 1; i ⇐ nBarCode; i++) { string result; result = String.Format("Barcode {0}\r\n", i); result += String.Format("Value = {0}\r\n", barcode.GetBarString(i)); result += String.Format("Type = {0}\r\n", barcode.GetBarStringType(i)); result += String.Format("Quality Score = {0}/5\r\n", barcode.GetBarStringQualityScore(i)); int nDirection = barcode.GetBarStringDirection(i); if (nDirection == 1) result += "Direction = Left to Right\r\n"; else if (nDirection == 2) result += "Direction = Top to Bottom\r\n"; else if (nDirection == 4) result += "Direction = Right to Left\r\n"; else if (nDirection == 8) result += "Direction = Bottom to Top\r\n"; int nPage = barcode.GetBarStringPage(i); result += String.Format("Page = {0}\r\n", nPage); System.Drawing.Rectangle rect = barcode.GetBarStringRect(i); result += String.Format("Top Left = ({0},{1})\r\n", rect.X, rect.Y); result += String.Format("Bottom Right = ({0},{1})\r\n", rect.X + rect.Width, rect.Y + rect.Height); result += "\r\n"; Console.Write(result); } }
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- 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.