Generates a barcode image in memory and writes it to an OutputStream. makeSimpleImage is lightweight and is the recommended method for generating an image. makeImage uses more resources and requires your web server to run in graphics mode (e.g. X-Window) but it allows you to use the fonts of your choice.
A second form of the function returns the barcode image in the form of java.awt.Image.
Syntax
public void makeSimpleImage(int imageType, int width, int height, boolean isBarWidth, java.io.OutputStream os) throws Exception public void makeSimpleImage(int imageType, int width, int height, boolean isBarWidth, int scale, String textOnly, java.io.OutputStream os, SimpleDimension actualImageSize) throws Exception public java.awt.Image makeSimpleImage(int width, int height, boolean isBarWidth, int scale, String textOnly) throws ExceptionAWT Version
public void makeImage(int imageType, int width, int height, boolean isBarWidth, java.io.OutputStream os) throws Exception public void makeImage(int imageType, int width, int height, boolean isBarWidth, int scale, String textOnly, java.io.OutputStream os, java.awt.Dimension actualImageSize) public java.awt.Image makeImage(int width, int height, boolean isBarWidth, int scale, String textOnly) throws Exception
Parameters
imageType
Indicates the image format:
width
Specifies either the desired width for the entire barcode or the width of the thinnest bar, in screen pixels, depending on the value of the isBarWidth parameter. Typically, it's more convenient to specify the width of the thinnest bar rather than that of the entire barcode.
height
Specifies the height of the barcode in screen pixels.
isBarWidth
If true, it indicates that the width parameter is the width of the tinnest bar; otherwise, it's the width of the entire barcode.
scale
This is typically one. If greater than 1, the entire image is scaled by this factor relative the specified width and height parameters and the font size.
actualImageSize
If not null, on return, it will contain the actual image size in its width and height data fields. SimpelDimension is defined as,
package com.bokai.drawing; public class SimpleDimension { public int width; public int height; public SimpleDimension(int w, int h) { width = w; height = h; } }
textOnly
If not null, the text it represents will be drawn instead of a barcode. In this case, you can specify 0 for both the width and the height parameters and the actual size of the image will be computed automatically to fit the text.
os
OutputStream to which the barcode image is to be written to.
Remarks
The roles of the width and height parameters are inversed if the barcode orientation (setOrientation) is 90 or 270 degrees.