public BarcodeData()
- (instancetype)init
public BarcodeData()
public:
BarcodeData();
__init__() # Default constructor
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.
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);
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document