ASP.NET Barcode Web Server Control Manual
& Tutorial
A license is required for each computer this software
is installed on;
this software may only be used according to the
License Agreement.
|
Easily add barcodes to ASP Dotnet web applications with our
100% managed code bar code controls. Our ASP .NET Linear Barcode Web Controls
support MICR E13B
and several barcode symbologies including PDF417, DataMatrix, Maxicode, Code 39, Extended Code 39, Telepen, Code 128, UCC/EAN-128, Interleaved 2 of 5, LOGMARS, Codabar, UPC, MSI,
EAN, Code 11, Code 93, Industrial 2 of 5 Planet and Postnet. They have
been tested and are compatible with Microsoft® C#.NET, VB.NET, Borland C#
Builder and Borland
Delphi .NET.
INDEX:
Installing our ASP .NET Web Control in your web application is a simple 3 step
process:
Step 1 - Install the control and setup security rights
-
Download and unzip the package. The DLL file will need to be placed in the bin
project directory for the web application that uses the DLL. For example, an
application named WebApplication1, needs the file to be in
C:\Inetpub\wwwroot\WebApplication1\bin as in the graphic below:
-
Create a sub directory directly under the virtual directory. For example, an
application named WebApplication1, needs the subdirectory of
C:\Inetpub\wwwroot\WebApplication1\IDAutomation as in the graphic
below:

This directory will be used to hold the JPEG barcode images that are generated.
-
You must grant the ASPNET user Modify and Write rights to the
IDAutomation sub directory you just created. You can do this in
Windows®
Explorer; right-click on the folder and select Properties. Failure to
grant these rights will produce a "specified image could not be found" error.

Step 2 - registering and using the server control in your web
application
After you have extracted the control to application bin folder, you have to
place it in the toolbox.
Registering the Control with an ASP .NET Web Application:
-
Open your solution or application and display the form that you want to add the
barcode to. Choose View - Toolbox to display the Toolbox.
Right-click on the Toolbox and choose Customize Toolbox. Choose the .NET
Framework Components folder. Choose Browse and select the server
control.
-
After the control appears in the Toolbox, it can be added to the web form. The
control cannot be manually sized; this is by design to eliminate scanning
errors and to ensure the dimensions are accurate. To make the barcode wider,
change the X Dimension property from .03 CM to .06 CM. By default, this is only
adjustable in increments of .03CM because the browser is limited to 96 DPI.

Registering the Control in Borland C# Builder or Delphi
for Microsoft®
.NET:
- Open the project. Choose Component - Installed .NET Components
from the menu. The Installed .NET Components dialog will appear.
- Ensure that the Installed .NET Components tab is selected and
then click on the Select an Assembly button.
- Navigate to the location where the IDAutomation.com Forms Control
was installed.
- Click Open and select the control.
- Click OK on the Installed .NET Components dialog.
- The barcode control will be in the General section of the Tools
Palette.
Using the control:
Once the control is placed on the form, it will appear in the web application
when it is compiled. To update the barcode with data use the DataToEncode
property in the code behind window, for example:
LinearBarcode1.DataToEncode = TextBox1.Text
The barcode can then be printed by the web browser.
Sizing the control:
The control cannot be sized manually because it must meet specific requirements
such as a precise X dimension (narrow bar width) and barcode height specified
in the properties of the control. To increase the width, increase the
XDimensionCM or XDimensionMILS property. To increase the height, increase the
BarHeightCM property. Because the control defaults to a 96 DPI image (which is
the resolution of the web browser), the X dimension can only be adjusted in
increments of .03 CM or 12 MILS. To allow other settings such as .045 CM, the
image ImageResolution must be increased to 203
or 300.
Using the control as a DLL for creating JPEG, TIFF, BMP, PNG or
other graphic files on the server:
Since our control uses the .NET framework to perform image conversions, you may
create a barcode image in any format that .NET supports. This example using C#
creates the control in memory without placing it on the form.
- Using Visual Studio.NET C#
{
//Create an instance of the Linear barcode
server control
IDAutomation.LinearServerControl.LinearBarcode
MyBarCode = new IDAutomation.LinearServerControl.LinearBarcode();
//Set the symbology
MyBarCode.SymbologyID =
IDAutomation.LinearServerControl.LinearBarcode.Symbologies.Code39;
//Set the DataToEncode
MyBarCode.DataToEncode = "123456789012";
//Save the image. The first parameter is the
full path and file name of the image. The at sign preceding the parameter
allows us to
//use the slash characters in the file name. The
second parameter is the type of file to save; specify .bmp, gif, .jpeg, .png, etc.
MyBarCode.SaveImageAs(@"C:\Temp\Images\Test39.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg
}
- Using Borland's C#Builder
//The following is an example of
changing the resolution of the barcode object and saving the image as a
JPEG.
barcode1.Resolution =
IDAutomation.LinearServerControl.LinearBarCode.Barcode.Resolutions.Custom;
//Define your own resolution size
barcode1.ResolutionCustomDPI = "300"; //Set the resolution
barcode1.XDimensionCM = "0.03"; //Set the X Dimension
//Here's where the file is saved.
barcode1.SaveImageAs("SavedBarcode300DPI.Jpeg",
System.Drawing.Imaging.ImageFormat.Jpeg);
barcode1.Resolution =
IDAutomation.Windows.Forms.LinearBarCode.Barcode.Resolutions.Printer;
//Reset the resolution to the default printer's DPI
Using the control for PocketPC:
If you need to print barcodes from a Pocket PC or Palm device that can
view webpages, you can use this web control to do so by enabling it on a
webpage designed for the device. We suggest enabling the PNG image type when
using PocketPC. The PNG files are generally smaller than JPEG files and some
older PocketPC browsers cannot display all JPEG files. View the
online demo of our PocketPC barcode application.
Step
3 - adjust the properties of
the control
After you insert the control in your web application as described in step
2, you may adjust the properties of the control. To do this, you can
change the properties with program code or you can right-click on the control
and choose Properties if it is installed on a form.
This section explains the main configuration parameters and methods of the
control:
NOTE: Many of the barcode sizing parameters are calculated in CM
(centimeters). Some barcode measurements are determined in "mils", which are
1/1000 of an inch. You may use the following rules for your conversions:
The default of .03CM is equal to about 12 mils
(which is read by most scanners) when printed.
To convert mils to CM, multiply the mils value by
.00254. For example, 12 mils * .00254 = .03 CM.
To convert CM to mils, divide the CM value by 2.54.
For example, .03 CM / 2.54 = 11.8 mils.
To convert inches to CM, multiply the value in inches
by 2.54.
Properties:
-
DataToEncode
- this is the data that is to be encoded in the barcode.
-
SymbologyID - this is the type of barcode to be used. The default is
code 128. For more information on barcode types,
visit our barcoding for beginners site.
-
BarHeightCM
- the height of the barcode in CM. Default is 1 CM.
-
leftMarginCM
- the space of the left margin in CM.
-
XDimensionCM - width in centimeters of the narrow bars. The default is
0.03 CM which is about .012" or 12 mils. You may need to increase this value if
your scanner cannot read barcodes with small X dimensions. If you have a
high quality laser or CCD scanner, you may decrease this value to
obtain a higher density barcode. Because the control defaults to a 96 DPI image
(which is the resolution of the web browser), the X dimension can only be
adjusted in increments of .03 CM or 12 MILS. To allow other settings such as
.045 CM, the image ImageResolution
must be increased to 203 or 300.
-
XDimensionMILS
- the width in mils (1/1000 of an inch) of the narrow bars.
-
ApplyTilde - in Code 128 auto, if set to "true",
you can use the format ~ddd to specify the ASCII code of the character to be
encoded. Default is off. For example, if you enter the following text in the
Data field: ~029NET you will actually be encoding GSNET Where GS
is a delimiter ASCII 29 character. Other commonly used ASCII codes are ~009 for
a tab and ~013 which is a return function. This property is only valid for Code
128 Auto.
-
CheckCharacter
- automatically adds the check digit to the barcode. The check digit is
required for all symbologies except Code 39, Industrial 2 of 5 and Codabar.
When using symbologies that do not require the check digit, you may disable the
check digit.
-
CheckCharacterInText
- automatically adds the check digit that is encoded in the barcode
to the human readable text that is displayed. This is not applicable
to Code 128.
-
CodabarStartCharacter
- the start character for CODABAR. Valid values are "A", "B", "C" or "D".
-
CodabarStopCharacter - the
stop character for CODABAR. Valid values are "A", "B", "C" or "D".
-
Code128CharSet - the set of characters to be used in code128. Valid
values are: AUTO, A, B or C. The default is AUTO. For more information on
Code 128, review our Code 128
FAQ.
-
BackColor
- the background color of the barcode.
-
ForeColor
- the color of the foreground text and bars in the barcode.
-
ImageAutoDelete
- if True will automatically delete the image files after the amount of
minutes
specified in ImageTimeToLive. Default is True. If this is set to false, make
sure a method is in place to delete the files occasionally so the hard
drive does not fill up.
-
ImageConcurrentDeletions
- the number of files that may be concurrently deleted by a single user
session. Default is 10. A new user session is required to delete
existing images that have been created after their ImageTimeToLive
expires.
-
ImageTimeToLive
- a number in minutes to keep generated images on the server. Default is 10.
-
ImageFileName
- a read only method that returns the name of the current file in the idautomation sub folder.
-
ImageResolution
- resolution of the created images. We do not recommend changing this setting
unless it is necessary. Because the control defaults to a 96 DPI image (which
is the resolution of the web browser), the X dimension can only be adjusted in
increments of .03 CM. To allow other settings such as .045 CM, the image DPI
must be increased to 203 or 300. In addition, to support low resolution barcode
printers that are 203 DPI, this setting should reflect the printer's DPI.
Because the browser displays images at 96DPI, they only look correct on the
screed at 96 DPI, however they will print correctly.
-
ImageType
- the type of image to be created, JPEG and PNG are supported.
-
Rotation
- indicates the orientation of the barcode. Valid values are 0 (normal), 90
(vertical),180 (inverted) and 270 (inverted vertical).
-
ShowText
- if this value is yes or true, the human readable text will be displayed with
the barcode.
-
TextMarginCM
- the distance between the lower portion of the barcode and the text.
-
TopMarginCM
- the top margin in CM.
-
Wide2NarrowRatio
- this is the wide to narrow ratio of symbologies that only contain narrow and
wide bars such as Code 39, Interleaved 2 of 5 and MSI. Usually, this value is
2, 2.5 or 3. The default value is 2.
-
UPCESystem - the encoding system to be used for UPC-E, valid values are
0 and 1.
Methods:
-
SaveImageAs (filename as string, format as ImageFormat) - this method allows the barcode object to be saved as an
image such as JPEG, GIF or PNG file. It also allows for conversion to any image type
that the framework supports. for example:
Barcode1.SaveImageAs(@"C:\Temp\Images\bar-code.png",
System.Drawing.Imaging.ImageFormat.Png)
PDF417: Read the
PDF417 FAQ for information about this symbology.
These properties are available only in the 2D version for
idautomation.pdf417servercontrol.dll. Properties not mentioned
here are the same as in the Linear Control.
-
XtoYRatio
- the X multiple height of individual cells; default=3, usually 2 to 4 times
the XDimensionCM (X).
-
PDFColumns
- controls the width and height by increasing the number of data columns in the
PDF417 barcode. The default is 0 and the maximum is 30. When this is left at 0
the control will automatically adjust this setting.
-
PDFErrorCorrectionLevel
- the Reed Solomon error correction level placed in the symbol. More error
correction creates a larger symbol that can withstand more damage. Default = 0
for automatic selection.
-
PDFMode
- the default, (binary mode) encodes bytes of data and text mode encodes all
characters on the US keyboard plus returns and tabs. If you are encoding only
text, text mode can sometimes reduce symbol size.
-
PDFRows - the number of minimum rows in the symbol. If this setting is
left at 0 the control will automatically adjust this setting. We recommend
leaving this alone because the number of rows should be automatically
generated.
-
ApplyTilde - if set to "true", you can use the format ~ddd to specify
the ASCII code of the character to be encoded. Default is on. Commonly used
ASCII codes are ~009 for a tab and ~013 which is a return function.
Data Matrix: Read the
DataMatrix FAQ for information about this symbology.
These properties are available only in the 2D version for
idautomation.datamatrixservercontrol.dll. Properties not
mentioned here are the same as in the Linear Control.
-
EncodingMode - the encoding mode that compresses information in the
symbol; valid values are, E_ASCII, E_C40, E_TEXT or E_BASE256 (default).
-
ASCII: it is used to encode data that mainly contains ASCII
characters (0-127). It encodes one alphanumeric or two numeric characters per
byte.
-
C40: it is used to encode data that mainly contains numeric and
upper case characters. C40 encodes three alphanumeric data characters into two
bytes.
-
TEXT: it is used to encode data that mainly contains numeric and
lowercase characters. TEXT encodes three alphanumeric data characters into two
bytes.
-
BASE256: it is used to encode bytes of data and 8 bit values.
-
More information about the modes is
documented here.
-
PreferredFormat (DM_FORMAT): sets the preferred format represented by a
number; valid values are from 0 (10X10) to 23 (144X144) and from 24 (8X18) to
29 (16X48); This will be automatically determined if the size of the symbol
chosen is too small. More about this is also documented
here.
-
ProcessTilde - if true ("Y") the tilde (~) will be processed. For
example, you may use ~d032 for a space character, ~I for a tab
and ~M to encode a return.
-
~X: Is used to represent character values from 0 to 26. Replace the X
like in the following example ~@ = means character ASCII 0, ~A= means
character 1, ~B=means character 2, ~C=means character 3 ...
-
~dNNN: Represents the ASCII character encoded by the 3 digits NNN. For exmaple,
~d065 represents the character 'A'.
-
~1: Represents the character FNC1. When FNC1 appears in the first position (or
in the fifth position of the first symbol of a Structured Append), it will
indicate that the data conforms to the UCC/EAN Application Identifier standard
format.
-
More about the tilde formatting is documented
here.
MaxiCode: Read the
MaxiCode FAQ for information about this symbology.
These properties are available only in the 2D version for
idautomation.maxicodeservercontrol.dll. Properties not
mentioned here are the same as in the Linear Control.
NOTE: Maxicode symbols must be printed at 200 DPI or greater, therefore, the
image ImageResolution must be increased.
When Maxicode is used for UPS applications, it is recommended that the input be
a single complete string, formatted with the specifications that UPS requires
and using the ApplyTilde function to encode the RS, GS and EOT codes as
recommended in
our Maxicode FAQ. For example:
[)>~03001~02996336260000~029840~029002~0291Z14647438~029UPSN~029410E1W~029195~029~0291/1~029~029Y~029135Lightner
~029TAMPA~029FL~030~004
-
ApplyTilde
- if set to "true", you can use the format ~ddd to specify the ASCII code of
the character to be encoded. Default is on. Commonly used ASCII codes are ~029
for GS, ~030 for RS, ~004 for EOT, ~009 for a tab and ~013 which is a return
function.
-
EncodingMode - modes 2 and 3 are designed for use in the transport
industry. They encode the destination address and the class of service as
defined by the carrier. Mode 4 can encode up to 93 characters or 138 digits.
Mode 5 can only encode up to 77 characters, but it provides more error
correction capabilities than mode 4. Mode 6 indicates that the symbol encodes a
message used to program the reader system (scanner). Mode 2 is the default.
The following properties are only used in modes 2 and 3 and are ignored if the
data begins with [)>RS01GS
as explained here.
-
CountryCode
- a 3 digit number representing the country code.
-
ServiceClass
- a 3 digit number representing the service code.
-
ZipCode - the postal code; mode 2 uses a 9 digit numeric postal code and
mode 3 uses a 6 character alphanumeric postal code.
MICR:
The .NET MICR web control is used to print MICR E-13 on bank checks.
These properties are available only in the MICR control (idautomation.micrservercontrol.dll) and the 2D version.
Properties not mentioned here are the same as in the Linear
Control.
-
LeftMargin - the margin between the left of the control area and the
beginning of the text measured in inches. The default is .1.
-
TopMargin
- the margin between the top of the control area and the top of the text
measured in inches. The default is .1.
-
BMP_Image
- a read-only method that returns a bitmap representation of the image.
-
CharacterHeight
- scales the height of each character in proportion to the optimum, default
size of each character. For example, setting this to 2 doubles the height.
-
CharacterWidth
- scales the width of each character in proportion to the optimum, default size
of each character. For example, setting this to .5 decreases the width by 50 %.
-
CharacterSpacing
- the number of inches between each character. The default is .06 inches to
allow for the optimal 8 characters per inch threshold.
-
PrintIntensity
- the intensity or darkness of the characters. There are 3 values that range
from darkest to lightest and they are Maximum, Nominal, and Minimum.
-
When troubleshooting MICR print issues, please refer to our
support incident about MICR
Advanced Properties (should only be performed by advanced programmers,
we recommend leaving these settings at their defaults)
-
AllowCustomPaths
- if set to True, allows custom paths for the files created. If
AllowCustomPaths is false, all of the images are created in the IDAutomation
subdirectory of the directory where the page is being served. For
example:
LinearBarcode1.AllowCustomPaths =
true;
LinearBarcode1.ImageLocalPath=@"C:\Inetpub\wwwroot\Application1\Images\Barcode";
LinearBarcode1.ImageRelativePath=@"Images/Barcode";
-
ImageLocalPath - local path to save images to. For example:
"C:\Inetpub\wwwroot\VirtDir\ImageDir". The ASPNET user must have Modify and
Write rights in this directory and
the directory cannot store the images outside of the virtual directory that is
running the page.
-
ImageRelativePath - the Image Relative Path to the images, for example:
with the path of C:\Inetpub\wwwroot\VirtDir\ImageDir (where the virtual
directory is VirtDir), enter ImageDir in this field. The relative
path is based off of the virtual directory of your website. If you need to use
a slash for the relative path, make sure you use the forward slash ( / ). This
will allow the control to work properly on Macintosh web browsers.
Symbology Specific Notes
UPC-A, UPC-E, EAN-8 and EAN-13
Enter the data to be encoded without any spaces or dashes. You can enter
the +2 and +5 add-on codes by just adding them to the end of the
string. If the check digit is added, it will be ignored and regenerated to
ensure that the code can be scanned. If you rotate the barcode by 270, you may
need to increase the top margin. For UPC-E, you must enter the full 11 or 12
digit UPC-A code and the barcode will be compressed if possible.
POSTNET and PLANET
When using the POSTNET barcode, the XDimensionCM (Narrow Bar Width) of .05
CM should be used. For barcodes to be acceptable to the US post offices, they
must be between 22 and 24 bars per inch. Setting the XDimensionCM to .05 should
produce about 23 bars per inch. You should adjust this setting for your printer
if your results are different.
Code 128
The "AUTO" setting for Code 128 will automatically switch character sets in
the barcode as necessary. Our implementation of Code 128 auto has many options
as described below:
-
Encoding functions such as tabs and returns in Code128:
If ApplyTilde is set to "true", you can use the format ~ddd to specify the
ASCII code of the character to be encoded. For example, Code~009Bar~013
will create a barcode that encodes Code<Tab
Function>Bar<Return Function>. For
other functions, refer to
the ASCII chart.
-
Encoding UCC/EAN-128:
To encode alpha-numeric UCC/EAN-128, the character set is set to "AUTO" for
automatic. Then, ASCII 202 or character Ê is entered as the FNC1 before each AI
and the required start C is also included. For example, the UCC number of
(8100)712345(21)12WH5678 should be entered as: Ê8100712345Ê2112WH5678.
In most cases the AIs will be properly represented in the human readable text.
If the parenthesis is not around the correct number for the AI, enter the
following extended ASCII character as the FNC1 for the correct number of digits
in your AI:
ASCII 212 = 2 digits
ASCII 213 = 3 digits
ASCII 214 = 4 digits
ASCII 215 = 5 digits
For example, to encode (1277)56, you would enter Ö127756.
-
For more information about this, please refer to the
UCC/EAN 128 section of our Code 128 FAQ or visit the
UCC website.
Technical Issues and Support
IDAutomation sub directory files:
The barcode images generated are high quality JPEG or PNG images that should
display in all web browsers. The files that are generated are stored in the IDAutomation sub directory. By default, the control will automatically delete
the image files after the amount of days specified in ImageTimeToLive. Each
call to the web page produces a new image, which are then deleted by first in
first out. If ImageAutoDelete is set to false, make sure a method is in
place to delete the files occasionally so the hard drive does not fill up.
Preferably, an administrator should create an automated task using the "AT"
command and a batch file that deletes all of the files in that directory during
a time when there are no users creating barcodes.
We haven't done any bench marks to measure server delay when there are files
being deleted. However, it would depend on the server CPU power, memory and
hard drive speed. If there are going to be many files deleted at once, it would
be best to write a simple batch process to clean out that folder containing the
images on a daily basis at a slow time for the server.
IDAutomation sub directory rights:
You must grant the ASPNET user Modify and Write rights to the
IDAutomation sub directory. This can be done in Windows® Explorer; right-click
on the folder and select "Properties". Failure to grant these rights will
produce a "specified image could not be found" error.
Error - "Specified image could not be found":
This error is caused because either the IDAutomation directory does not exist
in the correct place or the ASPNET user does not have Modify and Write
rights to the IDAutomation directory. To resolve, review the
procedures in Step 1.
To obtain additional technical support for this product, please visit the
ASP.NET Technical Support Site where all reported problems are
documented.
Subscribe to our
FREE IDAutomation.com newsletter to
receive updates on new products and symbologies available from us as well as
industry news related to barcoding in ASP. We respect the
privacy of our visitors. |
You may also view our
product index to obtain a list of all products we offer.
Copyright © 2000-2004 IDAutomation.com, Inc.
IDAutomation and BizFonts are registered trademarks of IDAutomation.com,
Inc. All
other
trademarks mentioned are the property of their respective owners.