Manual - Code 39
Introduction
Code 39 contains all the capital letters, the numbers from 0 to 9, the following special characters "-.$/+%" and spaces.
It exists in an extended version which allows you to write all the ASCII characters from 0 to 127. To do this, the special characters "$/+%" are used. If you wish to use these special characters, check with your reader. If it is not configured in Code 39 Extended mode, it will not work properly.
If you want to use the extended characters, you have to use the BakeryCode39extended.
This class inherits the BakeryBarcode1D class.
Example
Methods
BakeryCode39's Methods
-
checksum={
checksum } — Specifies if a checksum must be added
BakeryBarcode1D's Methods
-
thickness={
thickness } — Specifies the thickness of the barcode -
label={
label } — Sets the label -
font={
font } — Sets the text font for the label -
displayChecksum={
display } — Specifies the checksum to be added to the label
BakeryBarcode's Methods
-
text={
text } — Analyzes atext message to draw afterwards -
scale={
scale } — Sets the scale of the barcode -
foregroundColor={
color } — Sets the color of the bars -
backgroundColor={
color } — Sets the color of the spaces -
offsetX={
value } — Sets the X offset -
offsetY={
value } — Sets the Y offset
Code Example
import { BakeryColor, BakeryFont } from '@barcode-bakery/barcode-react';
import { BakeryCode39 } from '@barcode-bakery/barcode-react/1d';
export default function Home() {
const font = new BakeryFont('Arial', 18);
const colorBlack = new BakeryColor(0, 0, 0);
const colorWhite = new BakeryColor(255, 255, 255);
return <BakeryCode39
scale={2}
thickness={30}
foregroundColor={colorBlack}
backgroundColor={colorWhite}
font={font}
text='A123'
>;
}
Method explanations
-
checksum={
checksum } — Specifies if a checksum must be addedDescriptionSpecifies if a checksum must be added.
-
thickness={
thickness } — Specifies the thickness of the barcodeDescriptionThe thickness of the barcode in pixels. This is the vertical size. -
label={
label } — Sets the labelDescriptionThe text label will be written below or above the barcode depending on the barcode. You can write the special valueBakeryBarcode1D.Label if you would like your text to be chosen automatically. It will be the value passed to thetext={} method. -
font={
font } — Sets the text font for the labelDescriptionThe value of the argument must be an instance of theBakeryFontFile class. -
displayChecksum={
display } — Specifies the checksum to be added to the labelDescriptionSettingtrue will append the checksum to the default label.
The default value is true.
-
text={
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. -
scale={
scale } — Sets the scale of the barcodeDescriptionThe barcode will bex times bigger. Then a pixel will bex byx for its size. -
foregroundColor={
color } — Sets the color of the barsDescriptionSets the color of the bars of the barcode. By default, the color is black. This argument can be aBakeryColor class or any other argument thatBakeryColor can accept in its constructor. -
backgroundColor={
color } — Sets the color of the spacesDescriptionSets the color of the spaces of the barcode. By default, the color is white. This argument can be aBakeryColor class or any other argument thatBakeryColor can accept in its constructor. -
offsetX={
value } — Sets the X offsetDescriptionSpecifies the X offset of the barcode in pixels multiplied by the scale. -
offsetY={
value } — Sets the Y offsetDescriptionSpecifies the Y offset of the barcode in pixels multiplied by the scale.