Leadtools.Barcode Namespace : BarcodeExceptionCode Enumeration |
[SerializableAttribute()] public enum BarcodeExceptionCode : System.Enum, System.IComparable, System.IConvertible, System.IFormattable
'Declaration <SerializableAttribute()> Public Enum BarcodeExceptionCode Inherits System.Enum Implements System.IComparable, System.IConvertible, System.IFormattable
'Usage Dim instance As BarcodeExceptionCode
[SerializableAttribute()] public enum BarcodeExceptionCode : System.IComparable, System.IConvertible, System.IFormattable
ObjectiveC Syntax
Java Syntax
Leadtools.Barcode.BarcodeExceptionCode = function() { }; Leadtools.Barcode.BarcodeExceptionCode.prototype = {
LeadtoolsMemberMarker(replace me) };
[SerializableAttribute()] public enum class BarcodeExceptionCode : public System.Enum, System.IComparable, System.IConvertible, System.IFormattable
Member | Description |
---|---|
Barcode1dLocked | Barcode 1D is locked. |
Barcode2dReadLocked | Barcode Read 2D is locked. |
Barcode2dWriteLocked | Barcode Write 2D is locked. |
DatamatrixReadLocked | Barcode Read Datamatrix is locked. |
DatamatrixWriteLocked | Barcode Write Datamatrix is locked. |
DllNotFound | Barcode Engine assembly not found. |
InvalidBarcodeString | Invalid barcode string for a specified barcode symbology. |
InvalidBounds | Invalid barcode bounds. |
InvalidGroup | Invalid barcode group. |
InvalidHeight | Invalid barcode height. |
InvalidMaximumCount | Invalid maximum count. |
InvalidStringLength | Invalid barcode data string length. |
InvalidTextOut | Invalid barcode text out option. |
InvalidType | Invalid barcode symbology. |
InvalidUnits | Invalid barcode measurement unit. |
InvalidWidth | Invalid barcode width. |
InvalidXModule | Barcode Module size should be greater or equal to 0. |
PdfReadLocked | Barcode Read PDF is locked. |
PdfWriteLocked | Barcode Write PDF is locked. |
QrReadLocked | Barcode Read QR is locked. |
QrWriteLocked | Barcode Write QR is locked. |
ToSmall | Barcode string is too small. |
Used as the type of the BarcodeException.Code property which can be used to get extra details about the LEADTOOLS barcode exception being thrown.
Public Sub BarcodeExceptionCode_Example() ' Example of values passed by the user for the barcode width and height Dim barcodeWidth As Integer = 30 Dim barcodeHeight As Integer = 60 ' These values are too small to write a UPCA barcode and will throw an exception below ' Create a Barcode engine Dim engine As New BarcodeEngine() ' Get the Barcode writer Dim writer As BarcodeWriter = engine.Writer ' Create an image Using image As RasterImage = RasterImage.Create(1000, 1000, 1, 300, RasterColor.FromKnownColor(RasterKnownColor.White)) ' Create the barcode Dim barcode As BarcodeData = BarcodeData.CreateDefaultBarcodeData(BarcodeSymbology.UPCA) barcode.Bounds = New LogicalRectangle(0, 0, barcodeWidth, barcodeHeight, LogicalUnit.Pixel) ' Try to write it, this will throw an exception if the barcode is too smalle Try writer.WriteBarcode(image, barcode, Nothing) Catch ex As BarcodeException ' Show the error message, should be BarcodeExceptionCode.InvalidWidth Console.WriteLine(ex.Code) Debug.Assert(ex.Code = BarcodeExceptionCode.InvalidWidth) End Try End Using End Sub
public void BarcodeExceptionCode_Example() { // Example of values passed by the user for the barcode width and height int barcodeWidth = 30; int barcodeHeight = 60; // These values are too small to write a UPCA barcode and will throw an exception below // Create a Barcode engine BarcodeEngine engine = new BarcodeEngine(); // Get the Barcode writer BarcodeWriter writer = engine.Writer; // Create an image using(RasterImage image = RasterImage.Create(1000, 1000, 1, 300, RasterColor.FromKnownColor(RasterKnownColor.White))) { // Create the barcode BarcodeData barcode = BarcodeData.CreateDefaultBarcodeData(BarcodeSymbology.UPCA); barcode.Bounds = new LogicalRectangle(0, 0, barcodeWidth, barcodeHeight, LogicalUnit.Pixel); // Try to write it, this will throw an exception if the barcode is too smalle try { writer.WriteBarcode(image, barcode, null); } catch(BarcodeException ex) { // Show the error message, should be BarcodeExceptionCode.InvalidWidth Console.WriteLine(ex.Code); Debug.Assert(ex.Code == BarcodeExceptionCode.InvalidWidth); } } }
[TestMethod] public void BarcodeExceptionCode_Example() { // Example of values passed by the user for the barcode width and height int barcodeWidth = 30; int barcodeHeight = 60; // These values are too small to write a UPCA barcode and will throw an exception below // Create a Barcode engine BarcodeEngine engine = new BarcodeEngine(); // Get the Barcode writer BarcodeWriter writer = engine.Writer; // Create an image using(RasterImage image = RasterImage.Create(1000, 1000, 1, 300, RasterColorHelper.FromKnownColor(RasterKnownColor.White))) { // Create the barcode BarcodeData barcode = BarcodeData.CreateDefaultBarcodeData(BarcodeSymbology.UPCA); barcode.Bounds = LeadRectHelper.Create(0, 0, barcodeWidth, barcodeHeight); // Try to write it, this will throw an exception if the barcode is too smalle try { writer.WriteBarcode(image, barcode, null); } catch(Exception ex) { // Show the error message, should be BarcodeExceptionCode.InvalidWidth BarcodeException exception = BarcodeException.FromHResult(ex.HResult); Debug.WriteLine(exception.Code); Debug.Assert(exception.Code == BarcodeExceptionCode.InvalidWidth); } } }
public void BarcodeExceptionCode_Example() { // Example of values passed by the user for the barcode width and height int barcodeWidth = 30; int barcodeHeight = 60; // These values are too small to write a UPCA barcode and will throw an exception below // Create a Barcode engine BarcodeEngine engine = new BarcodeEngine(); // Get the Barcode writer BarcodeWriter writer = engine.Writer; // Create an image using(RasterImage image = RasterImage.Create(1000, 1000, 1, 300, RasterColor.FromKnownColor(RasterKnownColor.White))) { // Create the barcode BarcodeData barcode = BarcodeData.CreateDefaultBarcodeData(BarcodeSymbology.UPCA); barcode.Bounds = new LogicalRectangle(0, 0, barcodeWidth, barcodeHeight, LogicalUnit.Pixel); // Try to write it, this will throw an exception if the barcode is too smalle try { writer.WriteBarcode(image, barcode, null); } catch(BarcodeException ex) { // Show the error message, should be BarcodeExceptionCode.InvalidWidth Console.WriteLine(ex.Code); Debug.Assert(ex.Code == BarcodeExceptionCode.InvalidWidth); } } }
Public Sub BarcodeExceptionCode_Example() ' Example of values passed by the user for the barcode width and height Dim barcodeWidth As Integer = 30 Dim barcodeHeight As Integer = 60 ' These values are too small to write a UPCA barcode and will throw an exception below ' Create a Barcode engine Dim engine As BarcodeEngine = New BarcodeEngine() ' Get the Barcode writer Dim writer As BarcodeWriter = engine.Writer ' Create an image Using image As RasterImage = RasterImage.Create(1000, 1000, 1, 300, RasterColor.FromKnownColor(RasterKnownColor.White)) ' Create the barcode Dim barcode As BarcodeData = BarcodeData.CreateDefaultBarcodeData(BarcodeSymbology.UPCA) barcode.Bounds = New LogicalRectangle(0, 0, barcodeWidth, barcodeHeight, LogicalUnit.Pixel) ' Try to write it, this will throw an exception if the barcode is too smalle Try writer.WriteBarcode(image, barcode, Nothing) Catch ex As BarcodeException ' Show the error message, should be BarcodeExceptionCode.InvalidWidth Console.WriteLine(ex.Code) Debug.Assert(ex.Code = BarcodeExceptionCode.InvalidWidth) End Try End Using End Sub
System.Object
System.ValueType
System.Enum
Leadtools.Barcode.BarcodeExceptionCode
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2