|
The TAL Bar Code ActiveX control has a SaveBarCode method
that supports saving bar codes in the WMF, GIF, JPEG, PNG,
EPS, TIFF, BMP, TGA, and PCX file formats. Most Web browsers
support GIF and JPEG files and versions 4.0 and above of
both Netscape and Internet Explorer fully support PNG files.
All of the browser supported file formats GIF, JPEG and
PNG are raster style images meaning that they are made up
of an array of pixel values. Raster images are not "device
independent" meaning that it is possible to obtain different
results on different output devices. The reason for this
is that raster images contain a specific number of pixels
across and a specific number of rows of pixels. To obtain
the highest quality output, raster images should be created
at the same "dot resolution" as the printer that
they will be printed on.
The dot resolution of most printers is almost always much
higher that the dot resolution for most display monitors
therefore when you display a raster image on a display monitor,
it will be much larger than the same image outputted to a
printer. For example if you have a raster image that consists
of 300 pixels across and 300 rows of pixels and you print
that image on a printer that has a dot resolution of 300
dots per inch, you will end up with a one inch square image.
If you render the same image on a display monitor that has
a dot resolution of 100 dots per inch, you end up with an
image that is three inches square. If you want the image
to print at a high enough resolution to produce a high quality
bar code (typically 300 DPI or greater) however you want
the image to appear on the display monitor at the same size
that will actually be printed on the printer, you must scale
the image by the ratio of the screen resolution to the printer
resolution. Most programs (including web browsers) that work
with raster images provide features that allow you to scale
images to any desired size on screen while retaining any
higher resolution information when the image is sent to a
printer. For example, when you place an image tag in an HTML
document, you can also supply Height and Width tags that
instruct the browser to scale the image to the desired size
on screen no matter what the original image resolution is.
Scaling a raster image involves either adding or removing pixels to force the
image to a particular size. This process can causes the image quality to degrade
significantly when it is outputted to the screen. Likewise, if you were to
create the image at the screen resolution so that it appears at the correct
size on screen without having to scale it and then scale the image up before
sending it to a printer (so that it prints at the same size as the image on
screen), you will end with a printed output that is too low resolution and
too low quality to result in a readable bar code.
When creating bar codes, you are always better off creating
the image at the resolution of the target printer and then
scaling it down on screen to the desired size. This way,
the image should at least print at a high resolution even
though it may appear low in quality on screen. The important
point is that you want your bar codes to be readable from
a printed page. Most bar code readers are not capable of
reading bar codes from a computer screen therefore bar codes
are only useful when read from a printed page.
When you do not know the resolution of the target printer
(or the resolution of the display device), i.e., when generating
bar code images that will be displayed in a web page, the
best that you can do is make educated assumptions. You can
assume that most of your target users will have a 300 DPI
or greater printer and therefore create your bar code images
using 300 pixels per inch for the RasterImageResolution property
of the TAL Bar Code ActiveX Control.
Because you do not know with certainty the resolution of
the display used to view your web pages, you do not know
in advance how the image should be scaled in the browser
window. You can set the Height and Width of an image in HTML
code so that the browser will scale the image to a desired
size in pixels, however without knowing the screen resolution
you do not know how big a screen pixel is. The TAL Bar Code
ActiveX control provides a Height and Width property so that
you can determine the true size of your bar codes however
when working with raster images, the actual height and width
that you end up with is dependent on the dot resolution of
both the image and the output device. Fortunately the Windows
operating system always assumes that the screen resolution
is 96 pixels per inch no matter what the true value is so
scaling images under Windows is trivially easy. My guess
is that Mac and UNIX systems also use the same value of 96
pixels per inch for all display devices however this has
not been confirmed.
It is extremely important you scale the width of a bar code
as close as possible to the actual width that is returned
by the control after a bar code is generated. The width of
most bar codes will vary depending on the amount of data
that you encode. If you scale the width of a raster image
of a bar code to a value that is not the same (or as close
as possible) to the actual width returned by the control,
the browser will scale the image by either adding or removing
columns of pixels which will distort the widths of the bars
and spaces in the bar code and in the worst case, remove
entire bars or spaces (or stretch some of the bars or spaces)
and thus cause the bar code to become unreadable.
When attempting to produce bar codes as raster style images,
we strongly recommend that you test the printed output thoroughly
to make sure that your bar codes will be readable. Unfortunately
we can make no guarantees on the readability of any bar codes
rendered as raster images. You should be able to obtain good
results under most circumstances if you understand how raster
images work and develop your application to work within their
limitations.
|