![]() |
No. 1 Bar Code SDK Provider for Java/.NET Professionals
|
Category | Properties | Value | Comments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Basic | Property: data
URL: DATA |
Type: String
Default: "" |
Barcode value to encode
Code 39 Valid Data Char Set:
Code 39 extension Valid Data Char Set:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: addCheckSum
URL: ADD-CHECK-SUM |
Type: boolean
Default: false |
addCheckSum property is optional. Modulo 43 will be applied, if addCheckSum property is true. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Code 39 Special |
Property: extension
URL: EXTENSION |
Type: boolean
Default: false |
If you want to encode any 128 ASCII characters, extension must be true. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: I
URL: I |
Type: float
Default: 1.0f |
The space between 2 characters in code 39. This a multiple of X. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: N
URL: N |
Type: float
Default: 2.0f |
Wide/narrow ratio, 2.0 - 3.0 inclusive, default is 2. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: showStarStopInText
URL: SHOW-START-STOP-IN-TEXT |
Type: boolean
Default: true |
If true, display a * in the beginning and end of barcode text | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: processTilde
URL: PROCESS-TILDE |
Type: boolean
Default: false |
Set the processTilde property to true, if you want use the tilde character "~"
to specify special characters in the input data.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Barcode Size Related |
Property: uom
URL: UOM |
Type: int
Default: 0 (pixel) |
Unit of meature for all size related settings in the library.
Valid values: 0: pixel; 1: inch; 2: cm. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: X
URL: X |
Type: float
Default: 1 |
Width of barcode bar module (narrow bar), default is 1 pixel | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: Y
URL: Y |
Type: float
Default: 30 |
Height of barcode bar module, default is 30 pixel | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: barcodeWidth
URL: BARCODE-WIDTH |
Type: float
Default: 0 |
Barcode image width.
If barcodeWidth setting is smaller than the barcode required minimum width, the library will automatically reset to barcode minimum width. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: barcodeHeight
URL: BARCODE-HEIGHT |
Type: float
Default: 0 |
Barcode image height.
If barcodeHeight setting is smaller than the barcode required minimum height, the library will automatically reset to barcode minimum height. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: leftMargin
URL: LEFT-MARGIN |
Type: float
Default: 0 |
Barcode image left margin size. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: rightMargin
URL: RIGHT-MARGIN |
Type: float
Default: 0 |
Barcode image right margin size. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: topMargin
URL: TOP-MARGIN |
Type: float
Default: 0 |
Barcode image top margin size. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: bottomMargin
URL: BOTTOM-MARGIN |
Type: float
Default: 0 |
Barcode image bottom margin size. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: resolution
URL: RESOLUTION |
Type: int
Default: 72 |
Barcode image resolution in DPI (Dots per inch). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: rotate
URL: ROTATE |
Type: int
Default: 0 (IBarcode.ROTATE_0) |
Valid values:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Font Style |
Property: showText
URL: SHOW-TEXT |
Type: boolean
Default: true |
If true, display barcode data text under the barcode, otherwise do not display. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: textFont
URL: TEXT-FONT |
Type: Font
Default: new Font("Arial", Font.PLAIN, 11) |
Barcode text font style.
In Java Servlet web streaming, using the url paramter in the following format: &TEXT-FONT=Arial|bold|9 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: textMargin
URL: TEXT-MARGIN |
Type: float
Default: 6 |
Space between barcode and barcode data text, default is 6 pixel | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Methods |
// generate barcode and output to OutputStream object public boolean drawBarcode(OutputStream outputStream) throws Exception // generate barcode into a new BufferedImage object public BufferedImage drawBarcode() throws Exception /* Use this method to generate barcode, and save into gif or jpeg files 1. to save into gif file, filename ends with ".gif", like "c:\\barcode.gif" 2. to save into jpeg file, filename ends with ".jpg", like "c:\\barcode.jpg" */ public byte[] drawBarcodeToBytes() throws Exception public boolean drawBarcode(String imageFile) throws Exception // Generate barcode and save into EPS file, the filename must ends with ".eps" public void drawBarcode2EPS(String filename) throws Exception // Generate barcode on Graphics2D object within certain area public void drawBarcode(Graphics2D g, Rectangle2D rectangle) throws Exception |
Generating barcode Code 39 in Java Class example
Code39 barcode = new Code39(); /* Code39 Valid data char set: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (Digits) A - Z (Uppercase letters) - (Dash), $ (Dollar), % (Percentage), (Space), . (Point), / (Slash), + (Plus) Code39 extension Valid data char set: All ASCII 128 characters */ // Code39 encodes upper case chars only, for lower case chars, use Code 39 extension barcode.setData("CODE39-123456789012"); barcode.setExtension(false); barcode.setAddCheckSum(true); // Set the processTilde property to true, if you want use the tilde character "~" // to specify special characters in the input data. Default is false. // // 1) 1-byte character: ~0dd/~1dd/~2dd (character value from 000 ~ 255); ASCII character '~' is presented by ~126 // Strings from "~256" to "~299" are unused barcode.setProcessTilde(false); // Code 39 Wide Narrow bar Ratio // Valid value is from 2.0 to 3.0 inclusive. barcode.setN(3.0f); // The space between 2 characters in code 39; This a multiple of X; The default is 1.; // Valid value is from 1.0 (inclusive) to 5.3 (exclusive) barcode.setI(1.0f); barcode.setShowStartStopInText(true); // Unit of Measure, pixel, cm, or inch barcode.setUom(IBarcode.UOM_PIXEL); // barcode bar module width (X) in pixel barcode.setX(3f); // barcode bar module height (Y) in pixel barcode.setY(75f); // barcode image margins barcode.setLeftMargin(0f); barcode.setRightMargin(0f); barcode.setTopMargin(0f); barcode.setBottomMargin(0f); // barcode image resolution in dpi barcode.setResolution(72); // disply barcode encoding data below the barcode barcode.setShowText(true); // barcode encoding data font style barcode.setTextFont(new Font("Arial", 0, 12)); // space between barcode and barcode encoding data barcode.setTextMargin(6); // barcode displaying angle barcode.setRotate(IBarcode.ROTATE_0); /* to save into gif file, file name end with .gif to save into jpeg file, file name end with .jpg to save into eps file, call method drawBarcode2EPS and file name end with .eps */ barcode.drawBarcode("C:\\code39.gif");
Copyright © OnBarcode.com. All rights reserved.