Link Search Menu Expand Document

ASP (classic ASP)

The following example demonstrates how to use BarCode SDK as ActiveX object in classic ASP (Barcode class object) to generate barcodes and output as PNG images into a browser.

VISUAL BASIC 6 AND CLASSIC ASP SPECIAL NOTES: To use enumerations in VB6 or classic ASP you should use their integer values instead. To get integer value just check the documentation and you will see the integer value in the brackets. For example: (1) Code39.

VB
<%

Set bc = Server.CreateObject("Bytescout.BarCode.Barcode")

' datamatrix symbology
bc.Symbology = 15 ' 15 = DataMatrix symbology type

' set barcode value to encode
bc.Value = "http://www.bytescout.com"

' generate and get barcode image as PNG image array of bytes
 BarCodeImage = bc.GetImageBytesPNG

 response.ContentType = "image/png"

 ' add content type header 
 response.AddHeader "Content-Type", "image/png"

 ' set the content disposition
 response.AddHeader "Content-Disposition", "inline;filename=BarCode.png" 

 ' write the binary image to the Response output stream 
 response.BinaryWrite BarCodeImage
 response.End

' disconnect from libraries
Set bc = Nothing

%>