com.pdfjet
Class BarCode

java.lang.Object
  extended by com.pdfjet.BarCode
All Implemented Interfaces:
Drawable

public class BarCode
extends java.lang.Object
implements Drawable

Used to create one dimentional barcodes - UPC, Code 39 and Code 128. Please see Example_11.


Field Summary
static int BOTTOM_TO_TOP
           
static int CODE128
           
static int CODE39
           
static int LEFT_TO_RIGHT
           
static int TOP_TO_BOTTOM
           
static int UPC
           
 
Constructor Summary
BarCode(int type, java.lang.String str)
          The constructor.
 
Method Summary
 float[] drawOn(Page page)
          Draws this barcode on the specified page.
 void setBarHeightFactor(double barHeightFactor)
          Sets the bar height factor.
 void setBarHeightFactor(float barHeightFactor)
          Sets the bar height factor.
 void setDirection(int direction)
          Sets the drawing direction for this font.
 void setFont(Font font)
          Sets the font to be used with this barcode.
 void setLocation(float x1, float y1)
          Sets the location where this barcode will be drawn on the page.
 void setModuleLength(double moduleLength)
          Sets the module length of this barcode.
 void setModuleLength(float moduleLength)
          Sets the module length of this barcode.
 void setPosition(double x1, double y1)
          Sets the position where this barcode will be drawn on the page.
 void setPosition(float x1, float y1)
          Sets the position where this barcode will be drawn on the page.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UPC

public static final int UPC
See Also:
Constant Field Values

CODE128

public static final int CODE128
See Also:
Constant Field Values

CODE39

public static final int CODE39
See Also:
Constant Field Values

LEFT_TO_RIGHT

public static final int LEFT_TO_RIGHT
See Also:
Constant Field Values

TOP_TO_BOTTOM

public static final int TOP_TO_BOTTOM
See Also:
Constant Field Values

BOTTOM_TO_TOP

public static final int BOTTOM_TO_TOP
See Also:
Constant Field Values
Constructor Detail

BarCode

public BarCode(int type,
               java.lang.String str)
The constructor.

Parameters:
type - the type of the barcode.
str - the content string of the barcode.
Method Detail

setPosition

public void setPosition(double x1,
                        double y1)
Sets the position where this barcode will be drawn on the page.

Parameters:
x1 - the x coordinate of the top left corner of the barcode.
y1 - the y coordinate of the top left corner of the barcode.

setPosition

public void setPosition(float x1,
                        float y1)
Sets the position where this barcode will be drawn on the page.

Parameters:
x1 - the x coordinate of the top left corner of the barcode.
y1 - the y coordinate of the top left corner of the barcode.

setLocation

public void setLocation(float x1,
                        float y1)
Sets the location where this barcode will be drawn on the page.

Parameters:
x1 - the x coordinate of the top left corner of the barcode.
y1 - the y coordinate of the top left corner of the barcode.

setModuleLength

public void setModuleLength(double moduleLength)
Sets the module length of this barcode. The default value is 0.75

Parameters:
moduleLength - the specified module length.

setModuleLength

public void setModuleLength(float moduleLength)
Sets the module length of this barcode. The default value is 0.75

Parameters:
moduleLength - the specified module length.

setBarHeightFactor

public void setBarHeightFactor(double barHeightFactor)
Sets the bar height factor. The height of the bars is the moduleLength * barHeightFactor The default value is 50.0

Parameters:
barHeightFactor - the specified bar height factor.

setBarHeightFactor

public void setBarHeightFactor(float barHeightFactor)
Sets the bar height factor. The height of the bars is the moduleLength * barHeightFactor The default value is 50.0f

Parameters:
barHeightFactor - the specified bar height factor.

setDirection

public void setDirection(int direction)
Sets the drawing direction for this font.

Parameters:
direction - the specified direction.

setFont

public void setFont(Font font)
Sets the font to be used with this barcode.

Parameters:
font - the specified font.

drawOn

public float[] drawOn(Page page)
               throws java.lang.Exception
Draws this barcode on the specified page.

Specified by:
drawOn in interface Drawable
Parameters:
page - the specified page.
Returns:
x and y coordinates of the bottom right corner of this component.
Throws:
java.lang.Exception