For more information please visit our main site www.BarcodeTools.com.

CGI
  • A CGI (Common Gateway Interface) Application is an application that a WWW server can execute. The easiest way to create barcodes on your web server is to use a CGI application that generates barcodes. It is enough to install just one executable file on the server.
    Embedding a barcode into an HTML page is as easy as using IMG tags.
  • Our CGI applications are written in C++ and are executable files, which ensures higher speed and lower load for the web server.
    You can use our CGI applications both on the Windows platform and on Linux with either IIS or Apache servers.
  • Here you can test our barcode CGI applications online.


Using the CGI application
Install the CGI application, see below.
You can use this application right after that. Enter the address of your barcode CGI application into the browser address bar and you should see the barcode image.
You can see a sample DataMatrix barcode below.

Using Barcode CGI application

You can specify parameters to customize the barcode. For example, use the data parameter to encode the string "HelloWorld" in DataMatrix.

http://localhost/test/dmtxcgi?data=HelloWorld

See the corresponding description for more detailed information about the parameters of the CGI application (click CGI in the menu to the left and then, for example, click DataMatrix).

You can use the barcode CGI generator in an IMG tag of your HTML page.
For example:
<html>
<head>
<title>Barcode CGI generator</title>
<body>
<h2>Using Barcode CGI generator</h2>
<img src="http://localhost/test/dmtxcgi?data=1234567&w=120&h=120" alt="">
</body>
</html>
You will see a page like the one shown below.

Using Barcode CGI application in the HTML IMG tag


Installing the CGI application on a Linux (Apache) server
Download the necessary CGI application from our site:

Upload the CGI application (dmtxcgi file) in the binary mode to your server (for example, to the cgi-bin directory).
Set the execution permission (CHMOD) to 755, for example.
You can use the barcode CGI generator right after that.


Installing the CGI application on a Windows (IIS) server
We will go through the installation of the barcode CGI generator onto the server IIS 6.0. Some variations are possible if you install it on other servers. Download the necessary CGI application from our site:

Create a Virtual Directory and copy the file of the CGI application (dmtxcgi.exe file) to it. Set "Execute permissions" in the properties of the Virtual Directory as shown in the picture below. It is better to use a separate folder for CGI applications.

Setup IIS 6.0 barcode execute permissions

Set the security properties of the file as shown in the picture. The account the file of the CGI script will run under must have the Execute permission. See the picture below. If you do not do it, you will get the following error:
HTTP Error 401.3 - Unauthorized: Access is denied due to an ACL set on the requested resource.
Setup CGI file execute permissions

And the last. You must add CGI applications to the list of allowed "Web Service Extensions". If you do not do it, you will get error 404:
HTTP Error 404 - File or directory not found.

To do it, start Internet Information Service (IIS) Manager, click "Web Service Extensions" and add the CGI application as shown in the picture.
Add bar code CGI application into the IIS 6.0 Web Service Extensions

Also, you can allow "All Unknown CGI Extensions", but we do not recommend that you do it for security reasons.
You can also find information about installing CGI onto the Microsoft IIS server on the Microsoft site.
Configuring CGI Applications (IIS 6.0)
Installing CGI Applications in IIS 6.0 (IIS 6.0)
Configuring the Maximum Number of Concurrent CGI Requests (IIS 6.0)
Configuring CGI Application Timeouts (IIS 6.0)
Barcode CGI parameters
Our barcode CGI generators understand both GET and POST requests.

Parameter Name Description Corresponding property of Barcode-ActiveX Default value
w DataMatrix picture width.
h DataMatrix picture height.
xdim Barcode X-Dimension. This parameter makes sense only if the w parameter (for 0 degree orientation) are not used. 2
data Sets the data that is to be encoded in the Barcode. BarText 1234567
btype Barcode Type.
Possible values: 0...21
BarType 7
angle Orientation of the bar code.
Possible values: 0, 90, 180, 270
Orientation 0
quiet Show quiet zones.
Possible values: 0(hide) or 1(show)
ShowQuietZone 1
balign Barcode alignment.
Possible values: 0...2
BarAlign 2
talign Text alignment.
Possible values: 0...5
TextAlign 0
bcolor Background color.
Possible values: 000000...ffffff
The color must be presented as RGB, i.e. you should specify the value ff0000 for the red color.
BackColor ffffff (white)
fcolor Foreground color.
Possible values: 000000...ffffff
ForeColor 000000 (black)
tcolor Foreground color.
Possible values: 000000...ffffff
TextColor 000000 (black)
guard Show guard lines for EAN(UPC) bar codes.
Possible values: 0(hide) or 1(show)
ShowGuard 1
text Show barcode human readable text.
Possible values: 0(hide) or 1(show)
ShowText 1
tdown Place the text above or below.
Possible values: 0(above) or 1(below)
TextBottomTop 1
stst Show start/stop digits (if barcode have it).
Possible values: 0(hide) or 1(show)
ShowStSt 0
schk Show check digit (if barcode have it).
Possible values: 0(hide) or 1(show)
ShowCheck 1
cchk calculate an optional check digit or not.
Possible values: 0(no) or 1(yes)
CalcCheck 1
ntxt Convert nonprinting chars to text.
Possible values: 0(no) or 1(yes)
NonPrintingToTxt 1
c128 Code-128 charset.
Possible values: 0...3
Code128CharSet 0
fh Font height. 14
bred Barcode width reduction.
Possible values: -99...99
BarWidthReduction 0
w2n Wide to narrow ratio.
Possible values: 2...4
Wide2NarrowRatio 2.5
help Displays information about our Barcode CGI generator. See below.
debug Displays information about the error. See below.


Examples
If you specify the following parameters:

http://localhost/test/barcgi.exe?data=012345678912&btype=11&talign=4&h=80&bcolor=ffff00

"012345678912" will be encoded in the EAN-13 barcode, the image height is 80 pixels, the background color is yellow. See the picture below.

Using Barcode CGI barcode generator


To get information about the Barcode CGI application (and also the license information), just specify the parameter help:

http://localhost/test/barcgi.exe?help=1


If the web server returns an error for some reason (for example, a CGI Error for a Windows server or an Internal Server Error for Linux), you may have specified some parameters incorrectly. Try specifying the parameters as shown below and you will get such an error.

http://localhost/test/barcgi.exe?w=10

As you can see, the width of the bar code image is set to 10 pixels. Of course, a barcode image cannot have this size. To get debugging information, add the parameter debug and you will see an error message:

http://localhost/test/barcgi.exe?w=10&debug=1

Using Barcode CGI generator with debug information.