Manual - Code 39 Extended
Introduction
Code 39 Extended version allows you to write all the ASCII characters from 0 to 127 thanks to the special characters provided by the Code 39. These characters are "$/+%". Since the extended version of Code 39 is optional, you have to check your reader to see if it supports Code 39 Extended. Otherwise, the decoded code will be different from your input.
This class inherits the BCGcode39 class.
Example
Methods
BCGcode39extended's Methods
- No specific methods for this class.
BCGcode39's Methods
-
SetChecksum(bool
checksum ) — Specifies if a checksum must be added
BCGBarcode1D's Methods
- GetThickness() — Returns the thickness of the barcode
-
SetThickness(int
thickness ) — Specifies the thickness of the barcode - GetLabel() — Gets the label
-
SetLabel(string
label ) — Sets the label - GetFont() — Gets the text font for the label
-
SetFont(BCGFont
font ) — Sets the text font for the label - GetChecksum() — Gets the checksum appended to the barcode
-
SetDisplayChecksum(bool
display ) — Specifies the checksum to be added to the label
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 font = new BCGFont(new Font("Arial", 18));
var colorBlack = new BCGColor(Color.Black);
var colorWhite = new BCGColor(Color.White);
// Barcode Part
var code = new BCGcode39extended();
code.SetScale(2);
code.SetThickness(30);
code.SetForegroundColor(colorBlack);
code.SetBackgroundColor(colorWhite);
code.SetFont(font);
code.Parse("Ab39");
// Drawing Part
var drawing = new BCGDrawing(code, colorWhite);
var memoryStream = new MemoryStream();
await drawing
.FinishAsync(BCGDrawing.ImageFormat.Png, memoryStream);
Method explanations
-
SetChecksum(bool
checksum ) — Specifies if a checksum must be addedDescriptionSpecifies if a checksum must be added.
-
GetThickness()
—
Returns the thickness of the barcode
DescriptionThe thickness of the barcode in pixels. The value isn't multiplied by the scale.Returns
int - value in pixels -
SetThickness(int
thickness ) — Specifies the thickness of the barcodeDescriptionThe thickness of the barcode in pixels. This is the vertical size. -
GetLabel()
—
Gets the label
DescriptionReturns the real value that will be displayed with the barcode. You have to have called the
Parse() method first.Returnsstring - final label -
SetLabel(string
label ) — Sets the labelDescriptionThe text label will be written below or above the barcode depending on the barcode. You can write the special valueBCGBarcode1D.Label if you would like your text to be chosen automatically. It will be the value passed to theParse() method. -
GetFont()
—
Gets the text font for the label
DescriptionGets the text font for the label.Returns
-
SetFont(BCGFont
font ) — Sets the text font for the labelDescriptionThe value of the argument must be an instance of theBCGFontFile class. -
GetChecksum()
—
Gets the checksum appended to the barcode
DescriptionReturns the value that will be appended to the barcode. This method must be called after the method
Parse() .Returnsint - checksum added orfalse if no checkum is included -
SetDisplayChecksum(bool
display ) — Specifies the checksum to be added to the labelDescriptionSettingtrue will append the checksum to the default label.
The default value is true.
-
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.