Assume that we need to create a web application which
allows client computers to print shipping labels on
Zebra S600™ printers
(203 dpi in resolution).
On the shipping
label the barcode is required to be 1 inch tall with X
dimension at 15 mils (3 printer pixels).
The barcode encodes
a fixed 16-digit alpha numeric address which takes a form
of 6 capital letters followed by 10 digits,
such as KANADA1234567890.
Because the encoded data has a fixed data structure and length, the barcode length is always fixed. Moreover, since the X dimension is required to be 15 mils and the barcode targets a low-resolution printer, we need to take the second approach.
We need a container program to embed the object so we
can ask the object to provide the size information.
Microsoft Word is such a good container.
You can also use any OLE control containers such as
Visual Basic. If you do not have these programs, you
can write a simple WSH script to measure the size.
Before creating the object you need to set the target
printer as the default. This ensures that the measures
are taken from the printer. Now we start to create an object
based on the specification. First insert the object
into Microsoft Word document by selecting
from the
menu. Scroll down to locate
Morovia Barcode ActiveX and
click on .
The barcode control appears. Right click on the
control and select Propeties. On the pop-up property window,
find one called symbology and change its value
to mbxCode128. Make sure that
Measurement is set to
mbxMeasureEnglish.
Set message property to
KANADA1234567890.
Disable the
comment by setting ShowComment to
FALSE.
Since the human readable is required, make sure that
ShowHRText is TRUE.
Set NarrowBarWidth to 15 and
BarHeight to 1000.
The specification also says that the human readable
is printed on top of the barcode, with typeface
Arial, bold and size 9. Go back to the property window,
find property TextOnTop and
set it to TRUE.
Set TextAlignment to
mbxAlignmentLeft. Click on the
Font property, then click on the right small
button to pop up the Font dialog. Select Arial,
bold and 9 from the appropriate boxes.
Dismiss the dialog.
Now we have a barcode matching the specification.
![]() |
We keep the symbol margins intact. If you'd like to modify the symbol margins, look at the SymbolMarginXXXX entries.
Now we measure the overall size. From the property
window, find LabelWidth
and LabelHeight.
The program reports Labelheight as
1350 and
LabelWidth 2670. Since we are using English
imperial units, that translates into 1.350
inches in height and 2.670 inches in width.
After we retrieve the LabelWidth and LabelHeight in logical units, convert them into screen pixels rounding to the closest integer:
| Name | In logical units (inches) | In screen pixels (multiply the inch value by 96) |
|---|---|---|
| LabelWidth | 2.670 | 256 |
| LabelHeight | 1.350 | 130 |
We now write an ASP script called
barcode-zebra.asp to
provide the image feed. This ASP script sets properties
one by one. The message property is retrieved from the
URL query string. If you are interested with
how we did it, take a look at the sample included in the package.
After we finish the back end script, we proceed to add barcode to the front HTML file. Insert the following statement in the place of the barcode:
<IMG SRC="barcode-zebra.asp?message=KANADA1234567890" WIDTH="256" HEIGHT="130"/>
-
How to use the ADODB.Stream Object to send Binary Files to the browser:
