public BarcodeWriter Writer { get; } @property (nonatomic, strong, readonly) LTBarcodeWriter *writer; public BarcodeWriter getWriter() public:property BarcodeWriter^ Writer {BarcodeWriter^ get();}
Writer # get (BarcodeEngine)
The instance of the BarcodeWriter class associated with this barcode engine that can be used to write barcodes to an image.
The BarcodeWriter class is used to write one or more barcodes to an image. You cannot create an instance of BarcodeWriter directly, instead, use the instance created inside BarcodeEngine and accessed through BarcodeEngine.Writer.
using Leadtools;using Leadtools.Codecs;using Leadtools.Barcode;using Leadtools.ImageProcessing;public void BarcodeWriter_Example(){// Create a directory to store the images we will createstring outDir = Path.Combine(LEAD_VARS.ImagesDir, "MyBarcodes");if (Directory.Exists(outDir)){Directory.Delete(outDir, true);}Directory.CreateDirectory(outDir);int resolution = 300;// Create a Barcode engineBarcodeEngine engine = new BarcodeEngine();// Get the Barcode writerBarcodeWriter writer = engine.Writer;// All 1D options have the UseXModule set to false by default, we need to set it to true// so we can calculate the default size. We will change the default options so we can// pass null to CalculateBarcodeDataBounds and WriteBarcode below// For all Standard 1DOneDBarcodeWriteOptions oneDWriteOptions = writer.GetDefaultOptions(BarcodeSymbology.UPCA) as OneDBarcodeWriteOptions;oneDWriteOptions.UseXModule = true;// All GS1 Databar StackedGS1DatabarStackedBarcodeWriteOptions gs1DatabarStackedWriteOptions = writer.GetDefaultOptions(BarcodeSymbology.GS1DatabarStacked) as GS1DatabarStackedBarcodeWriteOptions;gs1DatabarStackedWriteOptions.UseXModule = true;// Patch CodePatchCodeBarcodeWriteOptions patchCodeWriteOptions = writer.GetDefaultOptions(BarcodeSymbology.PatchCode) as PatchCodeBarcodeWriteOptions;patchCodeWriteOptions.UseXModule = true;// All PostNet/PlanetPostNetPlanetBarcodeWriteOptions postNetPlanetWriteOptions = writer.GetDefaultOptions(BarcodeSymbology.PostNet) as PostNetPlanetBarcodeWriteOptions;postNetPlanetWriteOptions.UseXModule = true;// We will use this object to save filesusing (RasterCodecs codecs = new RasterCodecs()){// Get all the available write symbologiesBarcodeSymbology[] symbologies = writer.GetAvailableSymbologies();foreach (BarcodeSymbology symbology in symbologies){Console.WriteLine("Processing {0}", symbology);// Create the default data for this symbologyBarcodeData data = BarcodeData.CreateDefaultBarcodeData(symbology);// Calculate its size with default optionswriter.CalculateBarcodeDataBounds(LeadRect.Empty, resolution, resolution, data, null);// Create an image to write the data toLeadRect pixels = data.Bounds;using (RasterImage image = RasterImage.Create(pixels.Width, pixels.Height, 1, resolution, RasterColor.FromKnownColor(RasterKnownColor.White))){// Write the barcode with default optionswriter.WriteBarcode(image, data, null);// Save itstring outFileName = Path.Combine(outDir, symbology + ".tif");codecs.Save(image, outFileName, RasterImageFormat.Tif, 1);}}}}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
