|
Barcode, labelling and utility software |
Quick_links...Search siteTrial productsOnline tutorials Products
| Barcodes on web serversBarcodes can appear in web browsers as images created on the server. Server-side images are created on the server and transmitted as graphic files to the browser - just like any other graphic or text. The best solution is for IIS servers is to create a complete graphic of the barcode and transmit it from memory (ie. not requiring writing to the server's disk). This also simplifies the code sent to the browser - which merely receives the name of the graphic with <img> tags. For this solution the Barcode IMG Servers for IIS are ideal for ASP pages, while the dBarcode.NET components provide managed-code components for ASP.NET pages. Alternatively the barcode may be transmitted as a string of characters to be displayed in a specified font - even though that font is not installed on the browser's computer. To see how this operates see Barcode fonts on web pages. Creating barcode images on ASP.NET pagesThere are many possible approaches to generating barcode images for ASP.NET pages. Whatever method is chosen it is important to ensure that the image is created at a higher graphics resolution than the normal 96 dpi used for web images - because the width of the bars is important. Using a dBarcode.NET componentOne method, suitable for use when the barcode is to be data-dependent, is to use two aspx files, one which creates a memorystream barcode image using one of the dLSoft dBarcode.NET components and then uses a dummy ASP.NET page as the SRC for an IMG tag to display the image at the correct size, eg. <script language="vb" runat="server"> The Session variables ht and wd contain the actual sizes at which the barcode
image is to be drawn on the web page. These are calculated when the page is
loaded and used when the IMG SRC calls the second page. A working sample is included with each dBarcode.NET component distribution, and the technique may be seen in operation at our Barcodes Online service. Barcode IMG Server for IIS ASPA method suitable for ASP pages is to use one of the Barcode IMG Servers for IIS. The Barcode IMG Servers for IIS may be used to include barcode images on ASP pages, and a sample application is included with the distributions. The IMG Servers use a Barcode Object which generates a graphic image of the barcode. The Objects are created using Server.CreateObject("B1barcode.Control") for the ID server or Server.CreateObject("B2barcode.Control") for the 2D server. The Barcode Object has a number of properties which may be set to specify characteristics of the barcode required, and these are described in detail in the reference section. The object also has three properties which may be read to form the barcode image: PictureHeight and PictureWidth (which specify the sizes of the image) and the Pic() property which is a Variant that can be used to display the image in a web browser. A minimal sample (which just creates a fixed barcode) would be as shown below, and several sample pages are included in the "samples" subdirectory of the product's installation directory. There are three basic components: 1. GLOBAL.ASAThe global.asa file contains the code for creating the object and setting
properties, which will not change while the user, is viewing any ASP pages on
your site: 2. BARCD.ASPThis is a simple file that contains the code to return the image at the point
it is required. The file content is typically: 3. An ASP pageThis is the page that returns HTML to the users browser and will include the
barcode: |
|
Sites operated by DL Technology Ltd
dLSoft is a registered trade mark of DL Technology Ltd, a company registered in England number 3615271
|