Java ISSN Generator
|
ISSN: is similar to EAN-13 in encoding scheme and is a 9-digit data length linear barcode type. It is commonly used for labeling books. 9 digits length only 2. The number system 3. The manufacturer code 4. The product code 5. Check digit Note that the ISSN is preceded by the digits 977 and the ISSN check-digit (the last of the 8 digits) is not encoded. |
![]() |
1. Generate ISSN in Java class with the changing of barcode properties.
// Create Java ISSN object
ISSN barcode = new ISSN();
// Set ISSN data text to encode
barcode.setData("987654321");
// Generate ISSN barcode & print into Graphics2D object
//barcode.drawBarcode("Java Graphics2D object");
// Generate ISSN barcode & encode into GIF format
barcode.drawBarcode("C://barcode-issn.gif");
// Generate ISSN barcode & encode into JPEG format
barcode.drawBarcode("C://barcode-issn.jpg");
2. Generate & encode ISSN to EPS with changing the values concerned.
// Create Java ISSN object
ISSN barcode = new ISSN();
// Set ISSN data text to encode
barcode.setData("987654321");
// Generate ISSN barcode & encode into EPS
barcode.drawBarcode2EPS("C://barcode-issn.eps");
3. Generate & encode ISSN in html or jsp pages.
1. Copy barcode folder and its contents from demo package to Apache Tomcat.
2. Start Apache Tomcat, go to http://YourDomain:Port/barcode/barcode?DATA=987654321&TYPE=issn
3. Insert an image tag (img) into your page. For example,
<imgsrc="http://YourDomain:Port/barcode/barcode?DATA=987654321&TYPE=issn" />
4. Two ways to set the width and height of generated barcode ISSN image.
1. Set the values of the barcodeWidth and barcodeHeight properties.
or
2. Set X (bar module width) and Y (bar module height) values
ISSN Basic Settings
Properties | Value |
Comments
|
||
Property | URL | Options | Default | |
data | DATA | (Data to encode in the Codabar) | "" | ISSN value to encode ISSN Character Set:
|
addCheckSum | ADD-CHECK-SUM | (Data to encode in the Codabar) | false | addCheckSum property is not applied here. Code 2of 5does not require any checksum. |
ISSN Related Settings
Properties | Value | Comments |
||
Property | URL | Options | Default | |
topTextFont |
TOP-TEXT-FONT |
Font |
new Font("Arial", Font.PLAIN, 11) | Text above barcode font style. In Java Servlet web streaming, using the url paramter in the following format: &TEXT-FONT=Arial|plain|11 |
topTextColor |
TOP-TEXT-COLOR |
Font |
black | Text above barcode color |
supData |
NSUP-DATA |
String |
"" | Set the supplement data to encode. Valid values are 2 or 5 digits |
supHeight | SUP-HEIGHT |
float |
0.8of | A multiplicator of the height of the bar module; The default is 0.8 (80% of Y - bar module height). |
supSpace |
SUP-SPACE |
float |
15 | The separation between the barcode and the supplement. Default is 15 pixel. |
ISSN Text Settings
Properties | Value | Comments |
||
Property | URL | Options | Default | |
showText
|
SHOW-TEXT |
true or false |
true |
|
textColor
|
TEXT-COLOR |
Color |
black | Color of the shown text |
textFont
|
TEXT-FONT
|
Font |
new Font("Arial",Font.PLAIN,11) | The font, font style and font size of the text |
textMargin
|
TEXT-MARGIN
|
float |
6 | The space between the text and the barcode symbol |
ISSN Size Settings
Properties | Value | Comments |
||
Property | URL | Options | Default | |
rotate
|
ROTATE |
Degree0, 90, 180, 270 |
0 (Barcode.ROTATE) | Rotate the Angle of the Codabar images |
autoResize
|
AUTO-RESIZE |
true or false |
false | Auto resize the generated barcode image |
barcodeHeight |
BARCODE-HEIGHT |
float |
0 | Barcode image Height |
barcodeWidth |
BARCODE-WIDTH |
float |
0 | Barcode image Width |
bottomMargin |
BOTTOM-MARGIN |
float |
0 | Barcode image bottom margin size |
leftMargin | LEFT-MARGINE | float | 0 | Barcode image left margin size |
rightMargin | RIGHT-MARGIN | float | 0 | Barcode image right margin size. |
topMargin | TOP-MARGIN | float | 0 | Barcode image Top margin size |
barAlignment | BARALIGMENT | int | 1(center) | Barcode horizontal alignment inside the image. 0: left, 1: center, 2: right. |
uom |
UOM |
Pixel, Cm, or Inch |
0(Pixel) | Unit of Measure for all numeric properties.Valid values: 0: pixel; 1: inch; 2: cm. |
X | X | float | 1 | Width of barcode bar module (narrow bar), default is 1 pixel |
Y | Y | float | 30 | Height of barcode bar module, default is 30 pixel |
ISSN Color Settings
Properties | Value | Comments |
||
Property | URL | Options | Default | |
backColor |
BACK -COLOR |
Color |
white | Barcode image background color |
foreColor |
FORE -COLOR |
Color |
black | Barcode image foreground color |
ISSN Image Settings
Properties | Value | Comments |
||
Property | URL | Options | Default | |
resolution |
RESOLUTION |
int |
72 | Resolution of Codabar Image, Dots Per Inch |
Method
// 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 Exceptionpublic 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