Menu

Linear Barcode ActiveX in Internet and Web

Internet and Web Page Barcode FAQ

How to get bar codes over the Internet?

What browsers can show web pages with barcodes?

I use your Barcode ActiveX on the client side (in MS Internet Explorer). But I cannot make X-dimension equal to 0.6 mm. How can I solve this problem?

I use you Barcode ActiveX in an ASP page. How can I change the font?

I use you barcode control in ASP code. I would like to know if it is possible to save an image to the disk, for instance, as barcode.gif?



How to get bar codes over the Internet

There are two ways to use barcodes in web pages. They can be created either on the client side or on the server side.
Client Side Barcodes
You should install BarCode-ActiveX on each PC where you need to use it. In this case, you do not need to install anything on the server. There can be no server at all; web pages can be stored on your PC in this case. An example of such use is given here.
Create the barcodes in the Internet Explorer

Advantages and disadvantages of creating barcodes on the client side:

Advantages:
  • Any web server can be used with any OS (Windows, Linux, etc.). Or there can be no server at all; the HTML page can be stored on the client PC in this case.
  • The load on the server is lower as barcodes are generated on the client side.
  • Client-side scripting languages (JavaScript, VB Script) can be used to control BarCode-ActiveX
  • Only a small amount of data is transmitted because there is no need to send barcode images.
  • BarCode-ActiveX can be used not only in Internet Explorer, but also in other applications (Excel, Word, Access, VC, VB, Delphi, etc.).
Disadvantages:
  • BarCode-ActiveX needs to be installed on each client PC. Such installation can be avoided, but BarCode ActiveX must be available for downloading from the Internet in the form of a CAB file then.
  • Only Internet Explorer 4.0 (or higher) or browsers compatible with it can be used.
See also:
How to add a Barcode ActiveX to Internet Explorer

Server Side Barcodes
There are two ways to create barcodes on the server side.

1. The first way (see the picture below) is to use the SaveToImageFile method. In this case, a barcode is saved to a file of the JPEG, GIF, PNG or BMP format. After that the path to that file is specified in the HTML page, the Internet browser loads it and displays this image.

Create the barcodes in an IIS (Internet Information Server)

2. The second way is to use the BinaryWritePicture method. No intermediate files are created in this case and the image is sent to the client PC in the form of a byte array. This method seems to be more preferable because there is no need to control the process of creating/deleting files, give rights for accessing files, control their deletion, etc. Plus the load on the web server is lower.

Create the barcodes in an IIS (Internet Information Server) without any files

Advantages and disadvantages of creating barcodes on the server side:

Advantages:
  • There is no need to install any additional plug-ins on the client side. That is why it is easier to deploy a web application and maintain it.
  • Any web browser (not only Internet Explorer) can be used.
Disadvantages:
  • Only IIS (Internet Information Server) or servers compatible with it can be used as the web server.
  • The load on the web server is higher as barcodes are generated on the server.
  • The amount of data transmitted over the Internet is larger because whole barcode images are sent.
See also:
How to use Barcode ActiveX on an IIS server


What browsers can show web pages with barcodes

The answer to this question depends on the variant selected for creating barcodes – client-side or server-side. If it is client-side, only Internet Explorer 4.0 (or higher) can display barcodes. If it is server-side, any Internet browser capable of displaying JPEG, GIF, PNG or BMP files can display barcodes.


I use your Barcode ActiveX on the client side (in MS Internet Explorer). You can see my HTML file below:

<html>
<body>
<OBJECT ID="BarCode" WIDTH="276" HEIGHT="97"
CLASSID="CLSID:C26D9CA8-6747-11D5-AD4B-C01857C10000">
<param name="BarText" VALUE="123456789012">
<param name="BarType" VALUE="11">
<param name="TextAlign" value="4">
<param name="BackColor" value="16777215">
<param name="ForeColor" value="0">
<param name="Orientation" value="0">
<param name="CalcCheck" value="1">
<param name="ShowCheck" value="1">
<param name="Transparent" value="0">
<param name="ShowGuard" value="1">
<param name="ShowStSt" value="0">
<param name="ShowText" value="1">
<param name="ShowQuietZone" value="1">
<param name="TextColor" value="0">
<param name="TextBottomTop" value="1">
<param name="TxtEANFull" value="1">
<param name="BarAlign" value="2">
<param name="Wide2NarrowRatio" value="3">
<param name="Font" value="Courier">
<param name="JPEGQuality" value="100">
<param name="NonPrintingToTxt" value="1">
<param name="Code128CharSet" value="0">
</OBJECT>
</body>
</html>
But I cannot make X-dimension equal to 0.6 mm. How can I solve this problem?

If you use our ActiveX in Internet Explorer, you can specify the barcode X-dimension absolutely precisely. You should use the GetBarcodeWidth method for that. This method calculates the barcode width in millimeters and uses JavaScript code to write this value to HTML. You can see the HTML code of such a page below.
<html>
<head>
</head>
<body>

<SCRIPT LANGUAGE="JavaScript">
var barC = new ActiveXObject("ABarCode.ActiveBC.1");
barC.BarText = "123456789012";
barC.BarType = 11;
barC.ShowQuietZone = true;
barWidth = barC.GetBarcodeWidth(0.6, 600, 600, 2);

document.write( "<OBJECT ID=\"BarCode\" CLASSID=\"CLSID:C26D9CA8-6747-11D5-AD4B-C01857C10000\" style=\"width: ", barWidth, "mm; height: 20mm\">" );
</SCRIPT>

<param name="BarText" VALUE="123456789012">
<param name="BarType" VALUE="11">
<param name="TextAlign" value="4">
<param name="BackColor" value="16777215">
<param name="ForeColor" value="0">
<param name="Orientation" value="0">
<param name="CalcCheck" value="1">
<param name="ShowCheck" value="1">
<param name="Transparent" value="0">
<param name="ShowGuard" value="1">
<param name="ShowStSt" value="0">
<param name="ShowText" value="1">
<param name="ShowQuietZone" value="1">
<param name="TextColor" value="0">
<param name="TextBottomTop" value="1">
<param name="TxtEANFull" value="1">
<param name="BarAlign" value="2">
<param name="Wide2NarrowRatio" value="3">
<param name="Font" value="Courier">
<param name="JPEGQuality" value="100">
<param name="NonPrintingToTxt" value="1">
<param name="Code128CharSet" value="0">
</OBJECT>

<BR />
<BR />
<input LANGUAGE="JavaScript" TYPE="button" VALUE=" Print " ONCLICK="JavaScript:window.print();">

</body>
</html>
 
While using this HTML code, do not forget to change the printer resolution. You can do it in the following line:
barWidth = barC.GetBarcodeWidth(0.6, 600, 600, 2);
where 600x600 dpi is a printer resolution, 0.6 is x-dimension.

You can use this method to calculate sizes for DataMatrix and PDF417 ActiveX.


I use you Barcode ActiveX in an ASP page. How can I change the font?

Below you can see ASP code that creates a barcode and changes the default font.
<%
dim Barcode
Set Barcode = Server.CreateObject("ABarCode.ActiveBC.1")

set f = CreateObject("StdFont")
f.Name = "Courier"
f.Size = 25
f.Bold = True
f.Underline = True
Barcode.Font = f

Response.ContentType = "image/gif"
Response.BinaryWrite Barcode.BinaryWritePicture("gif", 200, 100)

SET Barcode=nothing
%>
 




I use you barcode control in ASP code. I would like to know if it is possible to save an image to the disk, for instance, as barcode.gif?

Sure, it is. You can use any properties and methods. Thus, you should use the SaveToImageFile method to save a barcode image.
<%
dim Barcode
Set Barcode = Server.CreateObject("ABarCode.ActiveBC.1")

Call Barcode.SaveToImageFile(250, 100, "c:\barcode.gif")

SET Barcode=nothing
%>
You should keep in mind that the user must have rights to write data to the corresponding folder. Usually, ASP code is executed under the IUSR_XXX account. And it usually has no such rights.