IDAutomation.com, Inc.

Your Source for Quality Symbology

[IDAutomation.com Home Page]

Home:  Products:  ASP.NET Web Server Controls: Manual & Tutorial

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:

ASP Web Control Tutorial

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

  1. 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:
    The ASP.NET Barcode Web Control DLL file will need to be placed in the bin project directory...
  2. 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:
    Creating the directory that will be used to hold the JPEG barcode images that are generated.
    This directory will be used to hold the JPEG barcode images that are generated.
  3. 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.
    You must grant the ASPNET user Modify and Write rights to the IDAutomation directory.

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:

  1. 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.
  2. 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.
    The ASP.NET Barcode Web Control

Registering the Control in Borland C# Builder or Delphi for Microsoft® .NET:

  1. Open the project. Choose Component - Installed .NET Components from the menu. The Installed .NET Components dialog will appear.  
  2. Ensure that the Installed .NET Components tab is selected and then click on the Select an Assembly button.
  3. Navigate to the location where the IDAutomation.com Forms Control was installed.
  4. Click Open and select the control.
  5. Click OK on the Installed .NET Components dialog. 
  6. 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.

 {
      //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
 }

//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.

Setting the properties of the ASP Dotnet Barcode Server Control in the application...Properties:

Methods:

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.

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.

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

The following properties are only used in modes 2 and 3 and are ignored if the data begins with [)>RS01GS as explained here.

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.


Advanced Properties (should only be performed by advanced programmers, we recommend leaving these settings at their defaults)


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:


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.

 

 Product Links: [Barcode Fonts | Barcode Components | Barcode Label Software | Barcode Scanners]

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.