![]() |
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 2 of 5 Valid Data Char Set:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Property: addCheckSum
URL: ADD-CHECK-SUM |
Type: boolean
Default: false |
addCheckSum property is not applied here. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Code 2 of 5 Special |
Property: N
URL: N |
Type: float
Default: 2.0f |
Wide/narrow ratio, 2.0 - 3.0 inclusive, default is 2. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 2 of 5 in Java Class example
Code25 barcode = new Code25(); /* Code 2 of 5 Valid data char set: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (Digits) */ barcode.setData("0123456789"); // Code 2 of 5 Wide Narrow bar Ratio // Valid value is from 2.0 to 3.0 inclusive. barcode.setN(3.0f); // 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:\\code2of5.gif");
Copyright © OnBarcode.com. All rights reserved.