Manual - Aztec
Introduction
Aztec code comes from the 2D barcode family. You can encode a large amount of information within a single barcode.
All the ASCII characters from 0 to 255 are supported. The barcode size will be determined by the number of data encoded and the chosen error correction level.
You can pass in ECI mode with the function SetTilde().
This class inherits the BCGBarcode2D class.
Example
Methods
BCGaztec's Methods
- GetErrorLevel() — Gets the error correction level of the barcode
-
SetErrorLevel(int
level ) — Sets the error correction level of the barcode - GetSize() — Gets the size of the barcode
-
SetSize(int
value ) — Sets the size of the barcode -
SetStructuredAppend(int
snum , intst , stringsname ) — Specifies that data will be expanded between multiple barcodes - GetTilde() — Gets if the behavior for tilde ~ is modified
-
SetTilde(bool
accept ) — Modifies the use of the tilde character ~ - GetRune() — Gets the Rune number to draw
-
SetRune(int
runeNumber ) — Specifies to draw a Rune
BCGBarcode2D's Methods
-
SetScaleX(int
scaleX ) — Sets the scaling X for the barcode -
SetScaleY(int
scaleY ) — Sets the scaling Y for the barcode
BCGBarcode's Methods
-
Parse(string
text ) — Analyzes atext message to draw afterwards -
Draw(Graphics
image ) — Draws the barcode on theimage -
GetDimension(int
width , intheight ) — Returns an array containing the required size for the image - GetScale() — Gets the scale of the barcode
-
SetScale(int
scale ) — Sets the scale of the barcode - GetForegroundColor() — Gets the color of the bars
-
SetForegroundColor(BCGColor
color ) — Sets the color of the bars - GetBackgroundColor() — Gets the color of the spaces
-
SetBackgroundColor(BCGColor
color ) — Sets the color of the spaces -
SetColor(BCGColor
foregroundColor , BCGColorbackgroundColor ) — Sets the color of the bars and spaces - GetOffsetX() — Gets the X offset
-
SetOffsetX(int
value ) — Sets the X offset - GetOffsetY() — Gets the Y offset
-
SetOffsetY(int
value ) — Sets the Y offset -
AddLabel(BCGLabel
label ) — Adds a label to the graphic -
RemoveLabel(BCGLabel
label ) — Removes a label from the graphic - ClearLabels() — Removes the labels from the graphic
Code Example
var colorBlack = new BCGColor(Color.Black);
var colorWhite = new BCGColor(Color.White);
// Barcode Part
var code = new BCGaztec();
code.SetScale(2);
code.SetForegroundColor(colorBlack);
code.SetBackgroundColor(colorWhite);
code.SetErrorLevel(23);
code.Parse("Aztec");
// Drawing Part
var drawing = new BCGDrawing(code, colorWhite);
var memoryStream = new MemoryStream();
await drawing
.FinishAsync(BCGDrawing.ImageFormat.Png, memoryStream);
Method explanations
-
GetErrorLevel()
—
Gets the error correction level of the barcode
DescriptionThe error correction level percentage.Returns
int - value between 0 and 99 -
SetErrorLevel(int
level ) — Sets the error correction level of the barcodeDescriptionThe error correction level percentage before drawing the barcode.
The level must be between 5 and 99.
The default value is 23. -
GetSize()
—
Gets the size of the barcode
DescriptionGets the size mode of the final barcode.
See SetSize() for more details.Returnsint - constant value defined inSetSize() -
SetSize(int
value ) — Sets the size of the barcodeDescriptionThe size of the final barcode will be decided automatically depending on the data you give and the error correction level percentage you have chosen.
You can, however, specify a different value in order to get a different code. Here are the possible values:
-BCGaztec.Size.Smallest : The code will be the smallest possible
-BCGaztec.Size.Compact : The code will try to be a compact code if possible
-BCGaztec.Size.Full : The code will be in full mode (with the reference grid)
The default value isBCGaztec.Size.Smallest . -
SetStructuredAppend(int
snum , intst , stringsname ) — Specifies that data will be expanded between multiple barcodesDescriptionThe Aztec code data can be separated throughout many different barcodes.
The first argument is the barcode number (beginning with 1), the second argument is the total number of barcodes you have. The last argument is optional, it specifies an identifier for you barcodes group. This argument must stay the same for every barcode in the group.
It is possible to encode the data on a maximum of 26 different barcodes.Returnsbool -true on success,false on failure -
GetTilde()
—
Gets if the behavior for tilde ~ is modified
DescriptionGets if the behavior for tilde ~ is modified.
See SetTilde() for more details.Returnsbool -true if activated,false otherwise -
SetTilde(bool
accept ) — Modifies the use of the tilde character ~DescriptionBy settingtrue in this argument, the tilde characters (ASCII 126 ~) will be processed as special characters. These are the special characters you can write.
- ~~ : Writes a simple tilde
- ~F : Writes the FNC1 character
- ~Exxxxxx : Writes the ECI xxxxxx character with x representing an integer from 0 to 9
The default value is false. -
GetRune()
—
Gets the Rune number to draw
DescriptionGets the Rune number to draw.Returns
int - Rune number orfalse if no Rune will be drawn -
SetRune(int
runeNumber ) — Specifies to draw a RuneDescriptionThe Rune numberruneNumber will be drawn to the screen. Runes are special symbols.
The Rune number has to be between 0 and 255.
The default value is -1.
-
SetScaleX(int
scaleX ) — Sets the scaling X for the barcodeDescriptionThe width in pixel of one module.
The default value is 1.
Note that this method is protected. -
SetScaleY(int
scaleY ) — Sets the scaling Y for the barcodeDescriptionThe height in pixel of one module.
The default value is 1.
Note that this method is protected.
-
Parse(string
text ) — Analyzes atext message to draw afterwardsDescriptionThe data you pass to thetext argument must be supported by the type of barcode you use.
Check each barcode's introduction section to obtain more information on how to use this method within each symbology. -
Draw(Graphics
image ) — Draws the barcode on theimage DescriptionThe value of theimage argument must be an image resource. The size of the image can be defined by the value received fromGetDimension() . -
GetDimension(int
width , intheight ) — Returns an array containing the required size for the imageDescriptionReturns an array in which the first index is the image width and the second index is the image height.
The arguments are used to specify the starting point of the drawing. Should be 0 for both.
TheBCGDrawing class uses this method to create the image resource.Returnsarray(int, int) - [0] is the width, [1] is the height -
GetScale()
—
Gets the scale of the barcode
DescriptionGets the scale of the barcode. The value is the number of the "smallest" unit in pixel.Returns
int - value in pixels -
SetScale(int
scale ) — Sets the scale of the barcodeDescriptionThe barcode will bex times bigger. Then a pixel will bex byx for its size. -
GetForegroundColor()
—
Gets the color of the bars
DescriptionGets the color of the bars of the barcode.Returns
-
SetForegroundColor(BCGColor
color ) — Sets the color of the bars -
GetBackgroundColor()
—
Gets the color of the spaces
DescriptionGets the color of the spaces of the barcode.Returns
-
SetBackgroundColor(BCGColor
color ) — Sets the color of the spaces -
SetColor(BCGColor
foregroundColor , BCGColorbackgroundColor ) — Sets the color of the bars and spacesDescriptionAn easy and fast method to set the color of the bars and spaces. Check theSetForegroundColor() andSetBackgroundColor() . -
GetOffsetX()
—
Gets the X offset
DescriptionGets the X offset of the barcode in pixels. The value isn't multiplied by the scale.Returns
int - value in pixels -
SetOffsetX(int
value ) — Sets the X offsetDescriptionSpecifies the X offset of the barcode in pixels multiplied by the scale. The required size returned byGetDimension() will be modified accordingly. -
GetOffsetY()
—
Gets the Y offset
DescriptionGets the Y offset of the barcode in pixels. The value isn't multiplied by the scale.Returns
int - value in pixels -
SetOffsetY(int
value ) — Sets the Y offsetDescriptionSpecifies the Y offset of the barcode in pixels multiplied by the scale. The required size returned byGetDimension() will be modified accordingly. -
AddLabel(BCGLabel
label ) — Adds a label to the graphicDescriptionAdds aBCGLabel object to the drawing. -
RemoveLabel(BCGLabel
label ) — Removes a label from the graphicDescriptionRemoves a specificBCGLabel object from the drawing. -
ClearLabels()
—
Removes the labels from the graphic
DescriptionClears the
BCGLabel objects from the drawing.