←Select platform

BarcodeData Constructor()

Summary
Initializes a new instance of the BarcodeData class with default values.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public BarcodeData() 
- (instancetype)init 
public BarcodeData() 
public: 
BarcodeData(); 
__init__() # Default constructor 
Remarks

This constructor initializes the BarcodeData member as follows:

Member Value
Symbology BarcodeSymbology.Unknown
Bounds LeadRect.Empty
RotationAngle 0
BarWidthReduction 0
Byte array inside GetData null (Nothing in Visual Basic)
Value null (Nothing in Visual Basic)
Tag null (Nothing in Visual Basic)

To quickly construct a new BarcodeData object with a specific symbology and data, use BarcodeData(BarcodeSymbology symbology, byte[] data) or BarcodeData(BarcodeSymbology symbology, string value).

To create an instance of BarcodeData suitable for writing for a specified symbology, use CreateDefaultBarcodeData.

Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Barcode; 
using Leadtools.ImageProcessing; 
 
 
public void BarcodeData_Example() 
{ 
   string imageFileName = Path.Combine(LEAD_VARS.ImagesDir, "Barcode1.tif"); 
 
   // Create a Barcode engine 
   BarcodeEngine engine = new BarcodeEngine(); 
 
   // Load the image 
   using (RasterCodecs codecs = new RasterCodecs()) 
   { 
      using (RasterImage image = codecs.Load(imageFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1)) 
      { 
         // Read the first barcode 
         BarcodeData data = engine.Reader.ReadBarcode(image, LeadRect.Empty, BarcodeSymbology.Unknown); 
 
         // Show the barcode data found (if any) 
         if (data != null) 
         { 
            Console.WriteLine("Found barcode at {0}", data.Bounds); 
            Console.WriteLine("Symbology: {0}", data.Symbology); 
            Console.WriteLine("Data: {0}", data.Value); 
         } 
      } 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.File; 
import java.io.IOException; 
import java.nio.charset.StandardCharsets; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.barcode.*; 
import leadtools.codecs.*; 
 
 
public void barcodeDataExample() { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   String imageFileName = combine(LEAD_VARS_IMAGES_DIR, "barcode1.tif"); 
 
   // Create a Barcode engine 
   BarcodeEngine engine = new BarcodeEngine(); 
 
   // Load the image 
   RasterCodecs codecs = new RasterCodecs(); 
       
   RasterImage image = codecs.load(imageFileName, 0, CodecsLoadByteOrder.BGR_OR_GRAY, 1, 1); 
             
   // Read the first barcode 
   BarcodeData data = engine.getReader().readBarcode(image, LeadRect.getEmpty(), BarcodeSymbology.UNKNOWN); 
 
   // Show the barcode data found (if any) 
   if (data != null) 
   { 
      System.out.printf("Found barcode at %s%n", data.getBounds()); 
      System.out.printf("Symbology: %s%n", data.getSymbology().getValue()); 
      System.out.printf("Data: %s%n", data.getValue()); 
   }      
          
   codecs.dispose(); 
   image.dispose(); 
   assertTrue("File does not exist", new File(imageFileName).exists()); 
   System.out.println("Command run and file exported to: " + imageFileName); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Barcode Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.