Barcode .Net Reference

Barcode.aspx
BarcodeHandler.aspx

Serves as a dynamic barcode image file and is used on a web server to dynamically generate barcode images.

Syntax

<img src="url_path/Barcode.aspx">
<img src="url_path/Barcode.aspx?param1=value1&param2=value2...">
<img src="BarcodeHandler.aspx">
<img src="BarcodeHandler.aspx?param1=value1&param2=value2...">
where url_path is a URL path that specifies the location of the Barcode.aspx file and parami, all optional, may be any of the following (case insensitive),
BarcodeType
Specifies the barcode type for the barcode image to be generated,
ValueMeaning
EAN13EAN-13 barcode.
EAN8EAN-8 barcode.
UPCAUPC-A barcode.
CODE39CHECKCode 39 Check barcode.
CODABARCodabar barcode.
CODE39(Default) Code 39 barcode.
C2OF5Code 2 of 5 barcode.
INTERLEAVED2OF5Interleaved 2 of 5 barcode.
UPCEUPC-E barcode.
EAN13_2EAN-13 + 2 barcode.
EAN13_5EAN-13 + 5 barcode.
EAN8_2EAN-8 + 2 barcode.
EAN8_5EAN-8 + 5 barcode.
UPCA_2UPC-A + 2 barcode.
UPCA_5UPC-A + 5 barcode.
UPCE_2UPC-E + 2 barcode.
UPCE_5UPC-E + 5 barcode.
EAN128AEAN-128 A barcode.
EAN128BEAN-128 B barcode.
EAN128CEAN-128 C barcode.
CODE93Code 93 barcode.
POSTNETPOSTNET barcode.
CODE128ACode-128 A barcode.
CODE128BCode-128 B barcode.
CODE128CCode-128 C barcode.
Data
Specifies the barcode data. Note that some characters may need to be URL-encoded as dictated by the HTTP specification. For example, you would use "+" for space " ".

If the barcode type supports check characters, it's not necessary to include them in the data.

If your barcode data contains a native character with no ASCII equivalent, you need to use the character whose (ANSI Western/Unicode) code is that of the native character plus 128. For example, in the Code-128 case, the FNC 1 character (native code: 102) would be represented by the character whose code is 102+128 = 230 (or 0xE6 in hex). To use such a character in a URL, you need to URL encode it; i.e., you would need to use 0xU00E6 for FNC 1.

AddOnData
Specifies the add-on barcode data if the barcode type has an add-on barcode.
ImageFormat
Specifies the image format the barcode is to be generated in:
ValueMeaning
GIF(Default) Gif format.
JPEGJPeg format.
PNGPng format.
TIFFTiff format.
BMPWindows BMP format.
BarWidth
Specifies the width of the narrowest barcode bar in pixels; the default is 1. If you specify BarWidth, you should not specify Width at the same time.
Width
Specifies the desired width of the barcode in pixels; depending on the orientation, this may either be the actual image width or height. An alternative way of specifying the barcode width is to use the BarWidth parameter.
Height
Specifies the desired height of the barcode in pixels; depending on the orientation, this may either be the actual image height or width.
Orientation
Specifies the orientation of the barcode image:
ValueMeaning
BottomFacing(Default) Bottom facing.
RightFacingRight facing.
TopFacingTop facing.
LeftFacingLeft facing.
Transparent
Specifies the barcode image generated should be transparent, if the image format used supports transparency:
ValueMeaning
TrueImage is transparent.
False(Default) Image is not transparent.
Caption
Specifies the barcode caption. This will be used to override the default caption that is the barcode data with any native characters removed.
AddOnCaption
Specifies the add-on barcode caption. This will be used to override the default add-on caption that is the add-on barcode data with any native characters removed.
FontName
Specifies the name of the font used to draw the barcode caption(s), e.g., Times New Roman. The font needs to exist on your server system. Default: Arial.
FontSize
Specifies the size of the font in points used to draw the barcode caption(s), e.g., 10.5. Default: 9.
FontStyle
Specifies the style of the font used to draw the barcode caption(s):
ValueMeaning
BoldBold text.
ItalicItalic text.
Regular(Default) Normal text.
StrikeoutText with a line through the middle.
UnderlineUnderlined text.
TextPosition
Specifies the position and visibility of the barcode caption:
ValueMeaning
AboveCaption above the barcode.
Below(Default) Caption below the barcode.
NotShownCaption hidden and no space reserved for it.
AddOnTextPosition
Specifies the position and visibility of the add-on barcode caption:
ValueMeaning
Above(Default) Add-on caption above the barcode.
BelowAdd-on caption below the barcode.
NotShownAdd-on caption hidden and no space reserved for it.
UniBarHeight
Specifies whether to use a single bar length to draw both the long and short bars if applicable:
ValueMeaning
TrueUse the same length for both long and short bars.
False(Default) Use separate lengths for long and short bars.
StretchText
Specifies whether to stretch the barcode caption to fit the full width of the barcode:
ValueMeaning
True(Default) Stretch the barcode caption.
FalseDo not stretch the barcode caption.
ShowCode39StartStop
Specifies whether to use a "*" to start and end the caption of a Code 39 barcode:
ValueMeaning
True(Default) Use "*" to start and end Code 39 barcode caption.
FalseDo not use "*" to start and end Code 39 barcode caption.
RetainAspectRatio
Specifies whether to adjust proportionally the barcode height when the barcode width is changed due to pixel alignment:
ValueMeaning
TrueAdjust height proportionally on width change.
False(Default) Do not adjust height on width change.
UpcSmallFont
Specifies whether to use a smaller font to draw the first and last characters of a UPC barcode caption:
ValueMeaning
True(Default) Use a smaller font to draw the first and last characters of a UPC barcode caption.
FalseDo not use a smaller font to draw the first and last characters of a UPC barcode caption.
BackColor
Specifies the background color of the barcode image. This may be a known color name like white, blue, etc., or a color value in the #rrggbb format, e.g., %2300ff00 for green; note that in a URL, # has to be URL-encoded as %23. Default: white.
ForeColor
Specifies the color of the barcode bars and caption(s). This may be a known color name like black, red, etc., or a color value in the #rrggbb format, e.g., %23ff0000 for red; note that in a URL, # has to be URL-encoded as %23. Default: black.
InvalidDataAction
Specifies the action to take when the barcode data is invalid:
ValueMeaning
DisplayNoneDraw nothing.
DisplayTextOnlyDraw only the (invalid) barcode data.
DisplayDefaultBarcodeDraw a barcode image corresponding to the default data "000000".
DisplayInvalid(Default) Draw the text "Invalid Data".

Remarks

Barcode.aspx is an actual file; you can put it anywhere in the directory tree of your web application. To use it in an HTML <img> element, you may need to specify the necessary directory path (i.e., url_path in the Syntax section above).

BarcodeHandler.aspx is not an actual file. To use it, you do not need to specify any directory path; the file name alone will do. However, you do need to add the following entry,

<httpHandlers>
  <add verb="GET" path="BarcodeHandler.aspx" type="Bokai.Barcodes.BarcodeHandler, Bokai.Barcodes" />
</httpHandlers>
in your application's Web.config file, which is located in your application's virtual directory (or C:\Inetpub\wwwroot\ if you don't have a specific application).
© 2002 Bokai Corporation. All rights reserved.