Questions? Call us at: (800) 722-6004 or (215) 496-0222

Using Barcode ActiveX Plus with Active Server Pages

System Requirements

  • A Microsoft Windows-based Server running either Microsoft Personal Web Server (PWS) or Microsoft Internet Information Server (IIS).
  • TALtech Barcode ActiveX Control (Plus version).
  • Microsoft Internet Explorer 4.01 or higher (recommended)

This example is designed to demonstrate how to generate server side barcodes using the TALtech Barcode ActiveX control (Plus version). It uses an ASP generated HTML form to collect information from the client about the type of barcode they wish to create - including the barcode symbology, the text to be encoded, the text for the comment, etc. When the user completes the form, their information is submitted to the server for processing. The ASP page then reads in the client supplied parameters, generates the barcode and saves it as an image file on the server. It then generates HTML code containing an Image tag which references the newly created barcode image. The generated HTML code is then passed back to the users browser which displays the resulting barcode.

Using this Example

It is not impossible that this example will work right "out of the box" with little or no modifications on your part, but don't be surprised if it does not. We have tested it on a Windows 98 machine running Personal Web Server 4.0, a Windows 2000 Server running IIS 5, and a Windows 98 Second Edition machine running Personal Web Server 4.0. However, this example is fairly complicated, there are many elements to it and therefore some of it may not work on your server. Usually if a line causes the script to fail an error is generated and appears in the Browser window identifying which line caused the problem, but it may still take some time to figure out why it is not working. So instead of taking this example and working backwards to fix the problems you encounter, we recommend you start a new application that uses just the basics and then build upon it, borrowing code and ideas from our example until you have rebuilt the application in such a way that not only does it work on your server, but it also does exactly what you want it to do:

  • Start with "Step1.asp" (included in the the example files). This code generates a barcode (using the default settings) with a hard coded filename (barcode1.png). and displays this image on the page. (The image will be huge because it is not being scaled to match your screen resolution - more on this later).
  • If you see the image, then add an HTML Form that allows the user to specify properties of the barcode and the code required to set those properties. If this step does not work then there is no point having any other code! See the troubleshooting page to help you figure out what is wrong
  • Once that is working you can add code that manages the filenames - not necessarily the way we chose - perhaps you would give the user the ability to name his own files.
  • Add any other features you need.

Note: The ASP code in this example is recursive. In other words the page contains logic so that it appears as a form prompting for information about the barcode that you want to generate the first time you view it. After you submit the form, the page will rewrite itself to display the resulting barcode.

Follow these steps to try to run the example "straight out of the box".

  1. Configure your Web Server to run ASP and make sure your Web Server is running.
  2. Install TAL Barcode ActiveX Plus (or Demo) on your Web Server.
  3. Download all the files discussed in this example. This is a self extracting Zip file containing:
    • "Barcode.asp" - the main (more advanced) example discussed here.
    • "Step1.asp" - a bare bones troubleshooting or starter file.
    • "Useful Code Snippets.txt" - Prewritten and tested code that you should be able to cut and paste into your application to enhance it with the minimum of editing:
      • Data Validation functions - catch errors before they happen by checking that the barcode message is suitable for the symbology selected.
      • Code to Determine the client's Operating System, Browser and Version - What if the client wants to create a .png file but is using Netscape 4 which cannot display it?
      • Code to delete the old image files from your server.
      • Code to verify that the image you just tried to create was actually created - Avoid broken links that make your site look bad!
    • fnum.txt" - a simple text file that will be used to track the file number.
  4. Double click on the downloaded file to extract the files. (By default they will be extracted to your temp folder ("C:\Windows\temp" on Windows 95/98 machines and "C:\temp" on Windows NT/2000 machines)
  5. Using Windows Explorer, copy the files into the root directory of your web server (usually "C:\Webshare\wwwroot" or "C:\InetPub\wwwroot").
  6. Open your Web browser and type in "" into the address line, change the properties that interest you on the form, and submit it. You should be rewarded with a barcode. If not, see: Troubleshooting Barcode ActiveX and ASP

View the Source Code behind Barcode.asp (fully commented).

Note: The form contains more features than the supplied ASP Code supports: Only the Message, Comment, Symbology and Image Format properties will be set by the ASP Code. As an exercise to help you understand how the example works you may find it useful to make the other properties on the form function too - this will help you learn to use both the ActiveX Control and ASP.

Categories: General Product Support, Macro / Code Sample, ASP (Active Server Pages), Barcode Generation, Programmers' Tools & Controls, Barcode ActiveX

Last Updated: 2013.08.08

Need more help?

Don't hesitate to call or email us with your questions

Our office is open 9AM - 5PM Monday Through Friday (E.S.T.)

Technical Support: 215-496-0202

Toll-Free: 1 (800) 722-6004
Skype: taltech1 (Voice only)