IDAutomation.com, Inc.

Your Source for Quality Symbology

[IDAutomation.com Home Page]

 
Home:  Products:  Barcode Components:  ASP .NET Barcode Web Component Advantage: Manual & Tutorial

ASP .NET Barcode Web Component Advantage Package
User 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.

INDEX:

Web Control Installation Methods

IDAutomation's ASP .NET Web Control Package may be executed in three different ways. Review the three methods and decide which implementation would be best for the desired outcome.

  1. Method 1; Streaming the barcode image without Visual Studio .NET: This method "streams" the image to the browser without saving any temp images to the server. This is the easiest installation method where the barcode is created in an application as a dynamic IMG tag and the barcode is modified from parameters passed; for example:
    <img src="http://yourserver.com/VirtualDir/IDAutomationStreamingLinear.aspx?barcode=123456789012&Code_Type=0"/>
    .
    For this install, (1) create a virtual directory on the web server, if one has yet to be created, and (2) upload three files to that directory, the barcodes are ready to be displayed. It is compatible with any application on any operating system that can create a dynamic IMG tag.
  2. Method 2; Streaming the barcode image for ASP.NET project integration: This method "streams" the image to the browser without saving it to the server. This implementation is similar to the above, except that the code behind method 2 can be used in a Visual Studio .NET solution. Just as in the first method, there is the option to create barcodes in another application as an IMG tag from parameters passed.
  3. Method 3; Install the Server Control for drag and drop use in an ASP.NET project: With this implementation, the control is installed in the web solution (Visual Studio .NET, Borland C# or Delphi for .NET) and used like any other server control. This method allows the resolution to be changed which is necessary to print barcodes at very precise X dimensions or if the printer printing the barcode is less than 300 DPI. This may be the easiest method of using the control and designing applications in WYSIWYG mode. This implementation requires one temp file to be created on the server for each barcode generated. However, the files are small and are automatically deleted after a specified time. Permanent files in many formats may also be created for specific functions.

Method 1 - Streaming the barcode image without Visual Studio .NET

This method "streams" the image to the browser without saving any temp images to the server. This is the easiest installation method where the barcode is created in an application as a dynamic IMG tag and the barcode is modified from parameters passed without using Visual Studio .NET. This implementation also allows the web server to become a barcode server that can create barcodes on the web in any application on any operating system that can create a dynamic IMG tag.

The following steps illustrate this process with the Linear Server Control. These steps will be the same for other IDAutomation Server Controls. The only thing that will change is the file name for the image generating web pages:

  1. Create a virtual directory on the web server, using IIS, to store the three files necessary to display the barcodes. This step may be omitted if the .aspx page is going to be called out of an existing virtual directory. If these files are not placed in a virtual directory, an error will appear. A virtual directory under IIS needs to be created from an existing physical directory. If the physical directory does not exist, create one using My Computer or Windows Explorer. 
    To create a virtual directory, follow these steps:
  2. Create a folder named 'bin' under the physical directory.
  3. Extract all files from the zip file downloaded after the purchase has been received or from IDAutomation's evaluation version download site.
  4. After these files are extracted, additional ZIP files will be found in the destination directory. Extract all files from IDAutomation_StreamingLinear_VB.zip.
  5. Copy IDAutomationStreamingLinear.aspx to the physical directory. This is the page that displays the barcode.
  6. Copy IDAutomation.LinearServerControl.dll and LinearStreamVB.dll to the bin directory created under the physical directory.
  7. To verify the project is working correctly, view the actual streaming aspx page in the browser from the local machine; for example:
    http://localhost/myAlias/IDAutomationStreamingLinear.aspx
  8. The barcode can now be created in another application as an IMG tag from parameters passed; for example:
    <img src="http://yourserver.com/myAlias/IDAutomationStreamingLinear.aspx?barcode=123456789012&
    Code_Type=0&Bar_Height=2"/>

    For a list of parameters.
  9. For an implementation example of this using JavaScript.
  10. The X dimension is only adjustable within increments of .03cm (about 12 mil). For more information, see the resolution notes.

Method 2 - Streaming the barcode image for ASP.NET project integration

The downloaded zip file contains a fully functional IDAutomationStreamingLinear.aspx page that may be included in the ASP.NET project. The following steps outline a basic example for streaming images to a ASP.NET web page using image tags and HTML. To implement code-behind using Visual Studio .NET, reference the sample project included in the ZIP file and the LinearStreamCS.csproj or LinearStreamVB.csproj file. These steps are the same for all IDAutomation Server Controls except the file names will be slightly different.

  1. Extract all files from the zip file downloaded after the purchase has been received or from IDAutomation's evaluation version download site.
  2. After these files are extracted, additional ZIP files will be found in the destination directory. Extract all files from the zip ending in VB if the project is in Visual Basic or from CS for a C# project. In this example, IDAutomation_StreamingLinear_VB.zip is used for a Visual Basic project.
  3. Locate the image generating web page aspx file from the extracted files. Copy this file and all associated files to the ASP.NET project directory. The image generating ASP.NET page for the linear control is IDAutomationStreamingLinear.aspx and its associated files are IDAutomationStreamingLinear.aspx.resx and IDAutomationStreamingLinear.aspx.vb.
  4. Copy the IDAutomation Server Control DLL file to the ASP.NET project directory. In this example, IDAutomation.linearservercontrol.dll is used.
  5. Add a reference to the IDAutomation Server Control in the project. For example: Right Click on References, choose Browse and select the server control DLL.
  6. Add the IDAutomationStreamingLinear.aspx file to the ASP.NET project by right-clicking the name of the project in Solution Explorer and selecting Add Existing Item. The following graphic illustrates the reference to the DLL and the image generating web page aspx file in a solution.
    Streaming the barcode image for ASP.NET project integration
  7. Rebuild the solution or project.
  8. To verify the project is working correctly, view the actual streaming aspx page in the browser; for example:
    http://localhost/WebApplication1/IDAutomationStreamingLinear.aspx

Next, choose the method that will update the properties of the barcode:

  1. Dynamic IMG Tag: The following code demonstrates how to pass parameters changing the data to encode in the barcode and the X dimension of the barcode via the URL Request. For a list of parameters.
    <img src="IDAutomationStreamingLinear.aspx?barcode=0123456789012&Code_Type=0&Bar_Height=1.5"/>
  2. Code-behind: To implement code-behind using Visual Studio .NET, reference the sample project included in the ZIP file and the LinearStreamCS.csproj or LinearStreamVB.csproj file. To the aspx page that needs to display the barcode image, add the image tag referencing the image generating aspx page which was added to the project. The following is an example of adding an HTML image tag:
    <img src="IDAutomationStreamingLinear.aspx"/>

Note: The Page_Load event for the image generating .aspx page may be changed to hard-code specific values for the image that is to be displayed.


Resolution notes about methods 1 and 2:

The default resolution for the image is 96 DPI. This allows for the image to be displayed properly in a browser. Using methods 1 and 2, the X dimension adjustment is limited to increments of .03cm. More about image resolution.

At times, it may be necessary to increase the resolution of the image for printing purposes. However, increasing the resolution causes the image to display proportionally larger in the browser. To compensate for this problem, the size of the image can be reduced or expanded using HTML. The following is an example of adjusting the size of the image based on HTML: 
<img src="IDAutomationStreamingLinear.aspx?barcode=123456789012" height="100px" width="400px"/>

If this process does not work in the application, then use Method 3.

 Method 3 - Install the Server Control for drag and drop use in an ASP.NET project

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 subdirectory 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. Grant the ASPNET user Modify and Write rights to the IDAutomation sub directory just created. To 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 the web application

After the control has been extracted to the application bin folder, then place it in the toolbox. 

Registering the Server Control with an ASP .NET Web Application:

  1. Open the solution or application and display the form 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 XDimension property from .03cm to .06cm. 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 Server 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 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 Xdimension (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 Xdimension can only be adjusted in increments of .03cm or 12mils. To allow other settings such as .045cm, 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 IDAutomation's control uses the .NET framework to perform image conversions, a barcode image can be created 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 barcodes are going to be printed from a Pocket PC or Palm device that can view web pages, use IDAutomation's web control to do so by enabling it on a web page designed for the device. IDAutomation suggests enabling the PNG image type when using Pocket PC. The PNG files are generally smaller than JPEG files and some older Pocket PC browsers cannot display all JPEG files. View the online demo of the Pocket PC barcode application.

Adjusting the properties of the component (Methods 2 and 3)

After the control is inserted in the web application as described in step 2, adjust the properties of the control. This is accomplished either by changing the properties with programming code or, if it is installed on a form, right-click on the control and choose Properties.

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. Use the following rules for 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 = .03cm.

To convert cm to mils, divide the cm value by 2.54. For example, .03cm / 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.

Data Matrix: Read the DataMatrix FAQ for information about this symbology.
These properties are available only in the 2D version for idautomation.datamatrixservercontrol.dll.

MaxiCode: Read the MaxiCode FAQ for information about this symbology.
These properties are available only in the 2D version for idautomation.maxicodeservercontrol.dll. 
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 the 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.


Advanced Properties (should only be performed by advanced programmers, it is recommended to leave the default settings.)

Barcode parameters for the IMG tag (Methods 1 and 2)

Parameter names for IDAutomation.com Server Controls
Note: Parameter names are NOT case-sensitive, however values are case-sensitive.

IDAutomationStreamingLinear.aspx specific parameters
(Note: (*) means property applies to ALL image generating files)

IDAutomationStreamingPDF417.aspx specific parameters
 
Read the PDF417 FAQ for information about this symbology.

IDAutomationStreamingMICR.aspx specific parameters

IDAutomationMaxicodeImage.aspx specific parameters
Read the MaxiCode FAQ for information about this symbology.
NOTE: Maxicode symbols must be printed at 200 DPI or greater.
When Maxicode is used for UPS applications, it is recommended that the EncodingMode be set to either 2 or 3, the resolution to 203, and 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 the Maxicode FAQ. For example:
http://LocalHost/IDAutomationMaxicodeImage.aspx?MODE=2&IR=203&

BARCODE=[)>~03001~02996336260000~029840~029002~0291Z14647438~029UPSN~029410E1W~029195~029~0291/
1~029~029Y~029135Lightner~029TAMPA~029FL~030~004

IDAutomationStreamingDataMatrix.aspx specific parameters
Read the DataMatrix FAQ for information about this symbology.

Symbology Specific Notes

UPC-A, UPC-E, EAN-8 and EAN-13
Enter the data to be encoded without any spaces or dashes. 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 the barcode is rotated by 270 degrees, the top margin might have to be increased. For UPC-E, 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 .05cm 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 .05cm should produce about 23 bars per inch. The printer setting may need to be adjusted if the results are different.

Code 128
The "AUTO" setting for Code 128 will automatically switch character sets in the barcode as necessary. IDAutomation's implementation of Code 128 auto has many options as described below:

Technical Issues and Support

The following issues apply to the streaming methods 1 and 2 only:

The following issues apply to the method 3 non-streaming implementation only:

To obtain additional technical support for this product, please visit the ASP.NET Technical Support Site where all reported problems are documented.

 

Copyright © 2000-2006 IDAutomation.com, Inc. IDAutomation and BizFonts are registered trademarks of IDAutomation.com, Inc. All other trademarks mentioned are the property of their respective owners. 

Over 70% of Fortune 100 companies use IDAutomation's products to automate their businesses.