Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,64 +1,60 @@
// Title: Add Quiet Zone to HIBC DataMatrix LIC Barcode
// Description: Demonstrates how to generate a HIBC DataMatrix LIC barcode with a ten‑module quiet zone using Aspose.BarCode.
// Category-Description: This example belongs to the Aspose.BarCode complex barcode generation category. It shows how to work with the ComplexBarcodeGenerator, HIBCLICSecondaryAndAdditionalDataCodetext, and SecondaryAndAdditionalData classes to create HIBC‑compliant DataMatrix barcodes. Developers often need to adjust quiet zones, module size, and padding to satisfy printing standards and regulatory requirements.
// Title: Adding a Quiet Zone to a DataMatrix HIBC LIC Barcode
// Description: Demonstrates how to configure a DataMatrix HIBC LIC barcode with a ten‑module quiet zone using Aspose.BarCode.
// Category-Description: This example belongs to the Aspose.BarCode generation category, illustrating the use of BarcodeGenerator, EncodeTypes, and barcode parameters such as XDimension and Padding. Typical use cases include creating compliant HIBC‑LIC barcodes for medical device labeling where a specific quiet zone is required. Developers often need to adjust module size, colors, and padding to meet printing standards.
// Prompt: Add a quiet zone of ten modules around a DataMatrix HIBC LIC barcode to meet printing standards.
// Tags: datamatrix, hibc, quietzone, png, generation, complexbarcode, aspose.barcodes, secondarydata
// Tags: datamatrix, hibc, quiet zone, png, aspose.barcodes, generation

using System;
using Aspose.BarCode.ComplexBarcode;
using System.IO;
using Aspose.BarCode;
using Aspose.BarCode.Generation;
using Aspose.Drawing;
using Aspose.Drawing.Imaging;

/// <summary>
/// Generates a HIBC DataMatrix LIC barcode with a ten‑module quiet zone and saves it as a PNG image.
/// Program demonstrating adding a quiet zone to a DataMatrix HIBC LIC barcode.
/// </summary>
class Program
{
/// <summary>
/// Entry point of the example. Prepares secondary data, configures barcode parameters, adds a quiet zone,
/// and saves the resulting image.
/// Entry point. Generates the barcode, applies a ten‑module quiet zone, and saves it as PNG.
/// </summary>
static void Main()
{
// Prepare secondary data for the HIBC LIC DataMatrix barcode (lot and serial numbers).
var secondaryData = new SecondaryAndAdditionalData
{
LotNumber = "LOT123",
SerialNumber = "SN001"
};

// Create the complex codetext object that combines the barcode type, link character, and secondary data.
var hibcCodetext = new HIBCLICSecondaryAndAdditionalDataCodetext
{
BarcodeType = EncodeTypes.HIBCDataMatrixLIC,
LinkCharacter = '+',
Data = secondaryData
};
// Sample HIBC LIC DataMatrix code text (Labeler ID + Product Number)
const string codeText = "A99912345";

// Initialize the complex barcode generator with the prepared codetext.
using (var generator = new ComplexBarcodeGenerator(hibcCodetext))
// Create the barcode generator for HIBC DataMatrix LIC
using (var generator = new BarcodeGenerator(EncodeTypes.HIBCDataMatrixLIC, codeText))
{
// Define the module size (XDimension) – 2 points per module.
// Set module size (XDimension) – 2 points per module
generator.Parameters.Barcode.XDimension.Point = 2f;

// Calculate quiet zone size: ten modules on each side.
float quietZone = generator.Parameters.Barcode.XDimension.Point * 10f;
// Calculate quiet zone size: 10 modules * XDimension
float quietZone = 10f * generator.Parameters.Barcode.XDimension.Point;

// Apply the quiet zone to all four padding sides.
generator.Parameters.Barcode.Padding.Left.Point = quietZone;
generator.Parameters.Barcode.Padding.Top.Point = quietZone;
generator.Parameters.Barcode.Padding.Right.Point = quietZone;
// Apply the quiet zone to all sides of the barcode
generator.Parameters.Barcode.Padding.Left.Point = quietZone;
generator.Parameters.Barcode.Padding.Top.Point = quietZone;
generator.Parameters.Barcode.Padding.Right.Point = quietZone;
generator.Parameters.Barcode.Padding.Bottom.Point = quietZone;

// Enable automatic sizing using interpolation mode.
generator.Parameters.AutoSizeMode = AutoSizeMode.Interpolation;
// Optional: set foreground and background colors
generator.Parameters.Barcode.BarColor = Aspose.Drawing.Color.Black;
generator.Parameters.BackColor = Aspose.Drawing.Color.White;

// Save the generated barcode as a PNG file.
generator.Save("hibc_datamatrix.png");
}
// Define output file path
string outputPath = "hibc_datamatrix.png";

// Ensure the output directory exists
string directory = Path.GetDirectoryName(Path.GetFullPath(outputPath));
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}

// Inform the user that the barcode has been generated.
Console.WriteLine("HIBC DataMatrix LIC barcode generated with a 10‑module quiet zone.");
// Save the barcode image as PNG
generator.Save(outputPath, BarCodeImageFormat.Png);
Console.WriteLine($"Barcode saved to {outputPath}");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,49 +1,53 @@
// Title: Generate HIBC DataMatrix LIC Barcode at 600 DPI
// Description: Creates a HIBC DataMatrix LIC barcode with secondary data and saves it as a 600 DPI PNG image.
// Category-Description: This example belongs to the Aspose.BarCode complex barcode generation category. It demonstrates how to use the ComplexBarcodeGenerator together with HIBCLICSecondaryAndAdditionalDataCodetext to produce high‑density HIBC LIC DataMatrix barcodes. Typical use cases include pharmaceutical labeling and inventory tracking where secondary information (lot, serial, dates) must be encoded at high resolution for small‑format labels.
// Prompt: Adjust the image resolution to 600 DPI when generating a DataMatrix HIBC LIC barcode for high‑density labels.
// Tags: datamatrix, hibc, lic, generation, resolution, png, complexbarcodegenerator, hibclicsecondaryandadditionaldatacodetext
// Title: Generate High‑Resolution DataMatrix HIBC LIC Barcode
// Description: Demonstrates how to create a DataMatrix HIBC LIC barcode with a 600 DPI image resolution for high‑density label printing.
// Category-Description: This example belongs to the Aspose.BarCode generation category, focusing on complex barcode creation using the ComplexBarcodeGenerator class. It shows typical usage of EncodeTypes, PrimaryData, and HIBCLICPrimaryDataCodetext to produce HIBC‑compliant DataMatrix barcodes, a common requirement for pharmaceutical and medical device labeling where high‑density, machine‑readable codes are needed. Developers often need to adjust image resolution, colors, and output formats for printing workflows.
/// Prompt: Adjust the image resolution to 600 DPI when generating a DataMatrix HIBC LIC barcode for high‑density labels.
// Tags: datamatrix, hibc, complexbarcode, resolution, png, generation

using System;
using Aspose.BarCode.ComplexBarcode;
using Aspose.BarCode.Generation;
using Aspose.BarCode.ComplexBarcode;
using Aspose.Drawing;

/// <summary>
/// Demonstrates generation of a HIBC DataMatrix LIC barcode with secondary data
/// and saves the image at 600 DPI resolution.
/// Example program that generates a high‑resolution DataMatrix HIBC LIC barcode.
/// </summary>
class Program
{
/// <summary>
/// Entry point of the example. Prepares secondary data, configures the generator,
/// and saves the high‑resolution barcode image.
/// Generates and saves the barcode image at 600 DPI.
/// </summary>
static void Main()
{
// Prepare secondary and additional data required for a HIBC LIC DataMatrix barcode
var secondaryCodetext = new HIBCLICSecondaryAndAdditionalDataCodetext
// Prepare primary HIBC data (product number, labeler ID, unit of measure)
var primaryData = new PrimaryData
{
ProductOrCatalogNumber = "12345",
LabelerIdentificationCode = "A999",
UnitOfMeasureID = 1
};

// Create HIBC DataMatrix LIC complex codetext
var hibcCodetext = new HIBCLICPrimaryDataCodetext
{
BarcodeType = EncodeTypes.HIBCDataMatrixLIC,
LinkCharacter = '+',
Data = new SecondaryAndAdditionalData
{
LotNumber = "LOT123",
SerialNumber = "SN456",
ExpiryDate = DateTime.Today.AddMonths(6),
ExpiryDateFormat = HIBCLICDateFormat.MMDDYY,
Quantity = 10,
DateOfManufacture = DateTime.Today
}
Data = primaryData
};

// Generate the barcode with a high image resolution (600 DPI)
using (var generator = new ComplexBarcodeGenerator(secondaryCodetext))
// Generate the barcode with high resolution (600 DPI)
using (var generator = new ComplexBarcodeGenerator(hibcCodetext))
{
// Set the resolution property to 600 DPI
// Set image resolution to 600 DPI
generator.Parameters.Resolution = 600;

// Save the generated barcode as a PNG file
generator.Save("HIBC_DataMatrix_600dpi.png");
// Optional: set foreground and background colors
generator.Parameters.Barcode.BarColor = Aspose.Drawing.Color.Black;
generator.Parameters.BackColor = Aspose.Drawing.Color.White;

// Save the barcode image as PNG
const string outputPath = "HIBC_DataMatrix_LIC.png";
generator.Save(outputPath, BarCodeImageFormat.Png);
Console.WriteLine($"Barcode saved to {outputPath} at 600 DPI.");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,48 +1,52 @@
// Title: Apply white background and black foreground to a QR HIBC LIC barcode
// Description: Demonstrates generating a QR HIBC LIC barcode with high‑contrast colors for printing.
// Category-Description: This example belongs to the Aspose.BarCode barcode generation category, focusing on complex barcode creation using the ComplexBarcodeGenerator and HIBCLICSecondaryAndAdditionalDataCodetext classes. It shows how to configure color parameters for QR HIBC LIC barcodes, a common requirement for clear, high‑contrast print output in healthcare and logistics applications. Developers often need to customize foreground and background colors when generating barcodes for scanners and label printers.
// Title: Generate a high‑contrast HIBC QR LIC barcode with white background and black foreground
// Description: Demonstrates how to create a HIBC QR LIC barcode using Aspose.BarCode, applying a white background and black foreground for optimal print contrast.
// Category-Description: This example belongs to the Aspose.BarCode complex barcode generation category, illustrating the use of the ComplexBarcodeGenerator and related codetext classes to produce specialized symbologies such as HIBC QR LIC. Developers often need to customize colors, embed secondary data, and export images in common formats. The snippet shows typical steps: preparing secondary data, configuring barcode parameters, and saving the result.
// Prompt: Apply a white background and black foreground to a QR HIBC LIC barcode for high‑contrast printing.
// Tags: barcode, hibc, qr, lic, color, background, foreground, generation, aspnet, aspose.barcode
// Tags: hibc, qr, lic, color, png, complexbarcodegenerator, secondaryandadditionaldata

using System;
using Aspose.BarCode.ComplexBarcode;
using System.IO;
using Aspose.BarCode.Generation;
using Aspose.BarCode.ComplexBarcode;
using Aspose.Drawing;

/// <summary>
/// Generates a QR HIBC LIC barcode with a white background and black foreground,
/// illustrating color customization for high‑contrast printing scenarios.
/// Example program that generates a HIBC QR LIC barcode with high‑contrast colors.
/// </summary>
class Program
{
/// <summary>
/// Entry point of the example. Creates secondary and additional data for a QR HIBC LIC barcode,
/// sets color parameters, and saves the resulting image.
/// Entry point of the application. Creates and saves a barcode image.
/// </summary>
static void Main()
{
// Prepare secondary‑and‑additional data codetext for a QR HIBC LIC barcode
// Prepare secondary data (lot and serial numbers) required for the HIBC LIC QR barcode.
var secondaryData = new SecondaryAndAdditionalData
{
LotNumber = "LOT123",
SerialNumber = "SN456"
};

// Build the complex codetext object that defines the barcode type, link character, and secondary data.
var hibcCodetext = new HIBCLICSecondaryAndAdditionalDataCodetext
{
BarcodeType = EncodeTypes.HIBCQRLIC, // QR version of HIBC LIC
LinkCharacter = '+', // Required link character
Data = new SecondaryAndAdditionalData
{
LotNumber = "LOT123" // Example secondary data
}
BarcodeType = EncodeTypes.HIBCQRLIC,
LinkCharacter = '+', // Required link character for HIBC QR LIC.
Data = secondaryData
};

// Generate the barcode with specified colors
// Generate the barcode using the complex barcode generator.
using (var generator = new ComplexBarcodeGenerator(hibcCodetext))
{
// Set foreground (barcode) color to black
// Set foreground (bars) to black.
generator.Parameters.Barcode.BarColor = Aspose.Drawing.Color.Black;

// Set background color to white
// Set background to white for high contrast.
generator.Parameters.BackColor = Aspose.Drawing.Color.White;

// Save the generated barcode image to a PNG file
generator.Save("hibc_qr.png");
// Define output file path and save the barcode as a PNG image.
string outputPath = "HIBC_QR.png";
generator.Save(outputPath, BarCodeImageFormat.Png);
Console.WriteLine($"Barcode saved to {Path.GetFullPath(outputPath)}");
}
}
}
Loading
Loading