⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tutorial.htm

📁 非常实用的条形码制作工具
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML dir=ltr>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<title>Tutorial</title>
</HEAD>
<BODY>
<h1>Tutorial</h1>

BarCode/JSP allows you to do dynamic barcode image generation using either
a servlet or a JSP page. Two graphics formats are supported: JPEG and PNG: 
<p>
- <a href="#jpeg">Dynamic JPEG Image</a><br>
- <a href="#png">Dynamic PNG Image</a><br>
</P>
Other topics that you may need to be aware of:
<p>
- <a href="#resolution">Barcode Size and Printer Resolution</a><br>
- <a href="#threading">Threading Model</a>
</p>

<a name="#jpeg"></a>
<h3>Dynamic JPEG Image</h3>
You can use dynamic barcode JPEG images in any HTML pages and this
doesn't require any scripting. Simply embed, for example, 
<pre>
	&lt;img src="..../BarcodeServlet?image=3&amp;type=6&amp;data=12345678"&gt;
or
	&lt;img src="barcode.jsp?image=3&amp;type=6&amp;data=12345678"&gt;
</pre>
in your HTML file and, <i>voila</i>, you have a dynamically generated Code 39 barcode 
image.
<p>
The advantage of the JPEG image format is that it's supported 
by virtually all commercial grade browsers in all their versions.
<p>
It's well-known that JPEG uses <i>lossy</i> image compression. 
BarCode/JSP generates JPEG with high quality (thus low compression).
The result is fairly good. However, you may see background noises
when printing using Netscape; we think that's because Netscape adopts
a low quality decompression approach (yes, like compression,
you can specify a quality parameter for decompression, too). Fortunately, our tests show
that the result is still scannable in our test conditions (300 dpi laser printer).

<a name="#png"></a>
<h3>Dynamic PNG Image</h3>
BarCode/JSP also generates barcode images in the PNG format, in addition
to JPEG. You use PNG image generation the same way you would JPEG.
For example, the following HTML mark-up will generate a
barcode image in PNG format:
<pre>
	&lt;img src="..../BarcodeServlet?image=1&amp;type=6&amp;data=12345678"&gt;
or
	&lt;img src="barcode.jsp?image=1&amp;type=6&amp;data=12345678"&gt;
</pre>
Unlike JPEG, PNG uses lossless image compression and gives you high
quality images. The only drawback is that PNG is only supported
by recent browsers (i.e., IE 4.0 or later and Netscape 4.04 or later).
If you're target these browsers, we highly recommend you use the
PNG image format.

<blockquote>
<b><i>Why Not GIF?</i></b><br>
<i>GIF is not supported for legal reasons. We'll support GIF when there's enough
demand for it. In fact, any web site operators who use GIF generation software
on their web site would need to pay a substantial amount in royalty fees to 
<a href="http://www.unisys.com">Unisys Coporation</a> (several thousand dollars 
as of this writing), in addition to any up-front fees that the software developer
would have to pay it.</i>
</blockquote>

<a name="#resolution"></a>
<h3>Barcode Size and Printer Resolution</h3>
The minimum barcode width on the screen is given by the
<a href="pnummod.htm">NumModules</a> property. The barcode width
can only be a multiple (1, 2, etc.) of this minimum width. You can change the 
scale factor when using barcode.jsp, e.g. &lt;img src=..../BarcodeServlet.jsp?barwidth=2&gt;
will use a scale factor of 2; 
if you script the BarCode/JSP component directly, you can
set this scale factor in <a href="mmakeimage.htm">makeSimpleImage/makeImage</a>,
<a href="msaveimage.htm">saveSimpleImage/saveImage</a> or <a href="menumstt.htm">enumerateBars</a>. 
While different bar
widths are in proportion on the screen, the printed version may 
be slightly different. The higher the printer resolution, the better the result
will be. If the printer resolution is low, you may need to use a scale 
factor of 2 or higher, so that the printed barcode is scannable.
Note that this is different from applications using directly
<a target="_top" href="http://www.bokai.com/barcode.htm">BarCode/OCX</a>
or DLL, in which case the barcode component has the
opportunity to tune the barcode directly according to the 
destination printer resolution.
<p>
If you find the barcode size too big, you can specify a <t>WIDTH</t>
attribute value for the <t>&lt;IMG&gt;<t> tag. This does not compromise
the intrinsic barcode image quality as it comes down from the server; the image is
simply scaled back at display time on the screen.

<a name="#threading"></a>
<h3>Threading Model</h3>
If you have to script BarCode/JSP directly, you need to know that a Barcode instance 
is not thread safe.
This means each Barcode instance can only be accessed safely from within a single
thread (you can have multiple instances belonging to different threads, though).
This is perfectly fine within an HTTP servlet's service, doGet or doPost method and
within a JSP page, as long as you create a new instance each time and are done with it 
upon leaving the method or JSP page.
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -