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¶m2=value2...">
<img src="BarcodeHandler.aspx">
<img src="BarcodeHandler.aspx?param1=value1¶m2=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,
Value | Meaning |
EAN13 | EAN-13 barcode. |
EAN8 | EAN-8 barcode. |
UPCA | UPC-A barcode. |
CODE39CHECK | Code 39 Check barcode. |
CODABAR | Codabar barcode. |
CODE39 | (Default) Code 39 barcode. |
C2OF5 | Code 2 of 5 barcode. |
INTERLEAVED2OF5 | Interleaved 2 of 5 barcode. |
UPCE | UPC-E barcode. |
EAN13_2 | EAN-13 + 2 barcode. |
EAN13_5 | EAN-13 + 5 barcode. |
EAN8_2 | EAN-8 + 2 barcode. |
EAN8_5 | EAN-8 + 5 barcode. |
UPCA_2 | UPC-A + 2 barcode. |
UPCA_5 | UPC-A + 5 barcode. |
UPCE_2 | UPC-E + 2 barcode. |
UPCE_5 | UPC-E + 5 barcode. |
EAN128A | EAN-128 A barcode. |
EAN128B | EAN-128 B barcode. |
EAN128C | EAN-128 C barcode. |
CODE93 | Code 93 barcode. |
POSTNET | POSTNET barcode. |
CODE128A | Code-128 A barcode. |
CODE128B | Code-128 B barcode. |
CODE128C | Code-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:
Value | Meaning |
GIF | (Default) Gif format. |
JPEG | JPeg format. |
PNG | Png format. |
TIFF | Tiff format. |
BMP | Windows 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:
Value | Meaning |
BottomFacing | (Default) Bottom facing. |
RightFacing | Right facing. |
TopFacing | Top facing. |
LeftFacing | Left facing. |
- Transparent
- Specifies the barcode image generated should be transparent, if
the image format used supports transparency:
Value | Meaning |
True | Image 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):
Value | Meaning |
Bold | Bold text. |
Italic | Italic text. |
Regular | (Default) Normal text. |
Strikeout | Text with a line through the middle. |
Underline | Underlined text. |
- TextPosition
- Specifies the position and visibility of the barcode caption:
Value | Meaning |
Above | Caption above the barcode. |
Below | (Default) Caption below the barcode. |
NotShown | Caption hidden and no space reserved for it. |
- AddOnTextPosition
- Specifies the position and visibility of the add-on barcode caption:
Value | Meaning |
Above | (Default) Add-on caption above the barcode. |
Below | Add-on caption below the barcode. |
NotShown | Add-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:
Value | Meaning |
True | Use 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:
Value | Meaning |
True | (Default) Stretch the barcode caption. |
False | Do not stretch the barcode caption. |
- ShowCode39StartStop
- Specifies whether to use a "*" to start and end the caption of a Code 39 barcode:
Value | Meaning |
True | (Default) Use "*" to start and end Code 39 barcode caption. |
False | Do 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:
Value | Meaning |
True | Adjust 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:
Value | Meaning |
True | (Default) Use a smaller font to draw the first and last characters of a UPC barcode caption. |
False | Do 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:
Value | Meaning |
DisplayNone | Draw nothing. |
DisplayTextOnly | Draw only the (invalid) barcode data. |
DisplayDefaultBarcode | Draw 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.