public static BarcodeData[] Load(string fileName)
public:static array<BarcodeData^>^ Load(String^ fileName)
def Load(self,fileName):
fileName
The XML file containing the data.
An array of BarcodeData for the objects found in the file, or an empty array if the file is valid but does not contain any data.
The load/save methods are provided as helper methods for the user. The BarcodeEngine, BarcodeReader and BarcodeWriter do not use these methods internally.
To save an array of BarcodeData to an XML file, use BarcodeData.Save(string fileName, BarcodeData[] data).
To save and load data to an XML stream, use BarcodeData.Save(Stream stream, BarcodeData[] data) and BarcodeData.Load(Stream stream).
using Leadtools;using Leadtools.Codecs;using Leadtools.Barcode;using Leadtools.ImageProcessing;public void BarcodeData_LoadSaveExample(){string imageFileName = Path.Combine(LEAD_VARS.ImagesDir, "Barcode1.tif");string xmlFileName = Path.Combine(LEAD_VARS.ImagesDir, "MyBarcodes.xml");// Create a Barcode engineBarcodeEngine engine = new BarcodeEngine();// Load the imageusing (RasterCodecs codecs = new RasterCodecs()){using (RasterImage image = codecs.Load(imageFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1)){// Read all the barcodesBarcodeData[] barcodes = engine.Reader.ReadBarcodes(image, LeadRect.Empty, 0, null);// Print out the barcodes we foundConsole.WriteLine("{0} barcodes found", barcodes.Length);for (int i = 0; i < barcodes.Length; i++){BarcodeData barcode = barcodes[i];Console.WriteLine(" {0} - {1} - {2}", i + 1, barcode.Symbology, barcode.Value);}Console.WriteLine("-----------------");// Save the barcodes to an XML fileBarcodeData.Save(xmlFileName, barcodes);// Now load the data back and print them outbarcodes = BarcodeData.Load(xmlFileName);Console.WriteLine("{0} barcodes loaded", barcodes.Length);for (int i = 0; i < barcodes.Length; i++){BarcodeData barcode = barcodes[i];Console.WriteLine(" {0} - {1} - {2}", i + 1, barcode.Symbology, barcode.Value);}}}}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";}
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
