using IronBarCode;using IronSoftware.Drawing;// Fluent API for Barcode Image generation.string value = "https://ironsoftware.com/csharp/barcode";AnyBitmap barcodeBitmap = BarcodeWriter.CreateBarcode(value, BarcodeEncoding.PDF417).ResizeTo(300, 200).SetMargins(100).ToBitmap();System.Drawing.Bitmap barcodeLegacyBitmap = (System.Drawing.Bitmap)barcodeBitmap;
using IronBarCode;
using IronSoftware.Drawing;
// Fluent API for Barcode Image generation.
string value = "https://ironsoftware.com/csharp/barcode";
AnyBitmap barcodeBitmap = BarcodeWriter.CreateBarcode(value, BarcodeEncoding.PDF417).ResizeTo(300, 200).SetMargins(100).ToBitmap();
System.Drawing.Bitmap barcodeLegacyBitmap = (System.Drawing.Bitmap)barcodeBitmap;
ImportsIronBarCodeImportsIronSoftware.Drawing' Fluent API for Barcode Image generation.Private value AsString = "https://ironsoftware.com/csharp/barcode"Private barcodeBitmap AsAnyBitmap = BarcodeWriter.CreateBarcode(value, BarcodeEncoding.PDF417).ResizeTo(300, 200).SetMargins(100).ToBitmap()Private barcodeLegacyBitmap AsSystem.Drawing.Bitmap = CType(barcodeBitmap, System.Drawing.Bitmap)
Imports IronBarCode
Imports IronSoftware.Drawing
' Fluent API for Barcode Image generation.
Private value As String = "https://ironsoftware.com/csharp/barcode"
Private barcodeBitmap As AnyBitmap = BarcodeWriter.CreateBarcode(value, BarcodeEncoding.PDF417).ResizeTo(300, 200).SetMargins(100).ToBitmap()
Private barcodeLegacyBitmap As System.Drawing.Bitmap = CType(barcodeBitmap, System.Drawing.Bitmap)
using IronBarCode;using IronSoftware.Drawing;// Create a QR code with advanced styling optionsGeneratedBarcode myBarCode = BarcodeWriter.CreateBarcode( "https://ironsoftware.com/csharp/barcode", BarcodeWriterEncoding.QRCode);// Add descriptive text above the barcodemyBarCode.AddAnnotationTextAboveBarcode("Product URL:");// Display the encoded value below the barcodemyBarCode.AddBarcodeValueTextBelowBarcode();// Set consistent margins around the barcodemyBarCode.SetMargins(100);// Customize the barcode color (purple in this example)myBarCode.ChangeBarCodeColor(Color.Purple);// Export as an HTML file for web integrationmyBarCode.SaveAsHtmlFile("MyBarCode.html");
using IronBarCode;
using IronSoftware.Drawing;
// Create a QR code with advanced styling options
GeneratedBarcode myBarCode = BarcodeWriter.CreateBarcode(
"https://ironsoftware.com/csharp/barcode",
BarcodeWriterEncoding.QRCode
);
// Add descriptive text above the barcode
myBarCode.AddAnnotationTextAboveBarcode("Product URL:");
// Display the encoded value below the barcode
myBarCode.AddBarcodeValueTextBelowBarcode();
// Set consistent margins around the barcode
myBarCode.SetMargins(100);
// Customize the barcode color (purple in this example)
myBarCode.ChangeBarCodeColor(Color.Purple);
// Export as an HTML file for web integration
myBarCode.SaveAsHtmlFile("MyBarCode.html");
ImportsIronBarCodeImportsIronSoftware.Drawing' Create a QR code with advanced styling optionsDim myBarCode AsGeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode", BarcodeWriterEncoding.QRCode)' Add descriptive text above the barcodemyBarCode.AddAnnotationTextAboveBarcode("Product URL:")' Display the encoded value below the barcodemyBarCode.AddBarcodeValueTextBelowBarcode()' Set consistent margins around the barcodemyBarCode.SetMargins(100)' Customize the barcode color (purple in this example)myBarCode.ChangeBarCodeColor(Color.Purple)' Export as an HTML file for web integrationmyBarCode.SaveAsHtmlFile("MyBarCode.html")
Imports IronBarCode
Imports IronSoftware.Drawing
' Create a QR code with advanced styling options
Dim myBarCode As GeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode", BarcodeWriterEncoding.QRCode)
' Add descriptive text above the barcode
myBarCode.AddAnnotationTextAboveBarcode("Product URL:")
' Display the encoded value below the barcode
myBarCode.AddBarcodeValueTextBelowBarcode()
' Set consistent margins around the barcode
myBarCode.SetMargins(100)
' Customize the barcode color (purple in this example)
myBarCode.ChangeBarCodeColor(Color.Purple)
' Export as an HTML file for web integration
myBarCode.SaveAsHtmlFile("MyBarCode.html")
IronBarcode 实现了一种流畅的 API 设计模式,支持方法链式调用,从而编写出更简洁、更易读的代码。 当需要对条形码进行多次转换时,这种方法尤其有用。
using IronBarCode;using IronSoftware.Drawing;// Generate, style, and convert a barcode in a single statementstring value = "https://ironsoftware.com/csharp/barcode";// Create PDF417 barcode with chained operationsAnyBitmap barcodeBitmap = BarcodeWriter .CreateBarcode(value, BarcodeWriterEncoding.PDF417) // Create PDF417 barcode .ResizeTo(300, 200) // Set specific dimensions .SetMargins(10) // Add 10px margins .ToBitmap(); // Convert to bitmap// Convert to System.Drawing.Bitmap for legacy compatibilitySystem.Drawing.Bitmap legacyBitmap = barcodeBitmap;
using IronBarCode;
using IronSoftware.Drawing;
// Generate, style, and convert a barcode in a single statement
string value = "https://ironsoftware.com/csharp/barcode";
// Create PDF417 barcode with chained operations
AnyBitmap barcodeBitmap = BarcodeWriter
.CreateBarcode(value, BarcodeWriterEncoding.PDF417) // Create PDF417 barcode
.ResizeTo(300, 200) // Set specific dimensions
.SetMargins(10) // Add 10px margins
.ToBitmap(); // Convert to bitmap
// Convert to System.Drawing.Bitmap for legacy compatibility
System.Drawing.Bitmap legacyBitmap = barcodeBitmap;
ImportsIronBarCodeImportsIronSoftware.Drawing' Generate, style, and convert a barcode in a single statementDim value AsString = "https://ironsoftware.com/csharp/barcode"' Create PDF417 barcode with chained operationsDim barcodeBitmap AsAnyBitmap = BarcodeWriter _ .CreateBarcode(value, BarcodeWriterEncoding.PDF417) _ ' Create PDF417 barcode .ResizeTo(300, 200) _ ' Set specific dimensions .SetMargins(10) _ ' Add 10px margins .ToBitmap() ' Convert to bitmap' Convert to System.Drawing.Bitmap for legacy compatibilityDim legacyBitmap AsSystem.Drawing.Bitmap = barcodeBitmap
Imports IronBarCode
Imports IronSoftware.Drawing
' Generate, style, and convert a barcode in a single statement
Dim value As String = "https://ironsoftware.com/csharp/barcode"
' Create PDF417 barcode with chained operations
Dim barcodeBitmap As AnyBitmap = BarcodeWriter _
.CreateBarcode(value, BarcodeWriterEncoding.PDF417) _ ' Create PDF417 barcode
.ResizeTo(300, 200) _ ' Set specific dimensions
.SetMargins(10) _ ' Add 10px margins
.ToBitmap() ' Convert to bitmap
' Convert to System.Drawing.Bitmap for legacy compatibility
Dim legacyBitmap As System.Drawing.Bitmap = barcodeBitmap
Jacob Mellor 是 Iron Software 的首席技术官,也是一位开创 C# PDF 技术的有远见的工程师。作为 Iron Software 核心代码库的原始开发者,他从公司成立之初就开始塑造公司的产品架构,与首席执行官 Cameron Rimington 一起将公司转变为一家拥有 50 多名员工的公司,为 NASA、特斯拉和全球政府机构提供服务。