Barcode web control that allows to generate/draw/save barcodes at server and serve it as an image.
Namespace:  Bytescout.BarCode
Assembly:  Bytescout.BarCode (in Bytescout.BarCode.dll)

Syntax

Visual Basic (Declaration)
Public Class BarcodeWebImage _
        Inherits Image
C#
public class BarcodeWebImage : Image
Visual C++
public ref class BarcodeWebImage : public Image
JavaScript
Bytescout.BarCode.BarcodeWebImage = function();

Type.createClass(
        'Bytescout.BarCode.BarcodeWebImage',
        Image);

Remarks

To use BarcodeWebControl in a web application created without Visual Studio, you need to do two things:

  1. First, you need to copy the Bytescout.BarCode.dll file to the bin subdirectory of your web application's virtual directory as registered with IIS. If you don't have a separate web application, you can copy it to C:\Inetpub\wwwroot\bin.
  2. Next, you do need to modify the Web.config file in your application's virtual directory (or C:\Inetpub\wwwroot\ if you don't have a separate application), by adding,
      Copy Code
                <httpHandlers>
                    <add verb="*" path="BarcodeHandler.aspx" type="Bytescout.BarCode.BarcodeHandler, Bytescout.BarCode"/>
                </httpHandlers>
                
    
    inside <system.web> section.

Note that there's no actual file called BarcodeHandler.aspx, but you can reference it within your application as a URL and you don't need to specify any path.

  Copy Code
            <img src="/BarcodeHandler.aspx?symbology=Code128&value=DATA" />
            

For a full list of parameter names see the table below.

To use BarcodeWebControl in a web application created within Visual Studio, you need:

  1. Add new web.config file if you don't have one.
  2. Set up an HttpHandler in an ASP.NET web application by adding <httpHandler> section as written above.
  3. Dag and drop BarcodeWebImage from toolbox to your web page. This will add the references to Bytescout.BarCode.dll to your project. You can fine tune added control appearance by means of Windows Forms designer.

Below is a table of BarcodeHandler.aspx parameters:

Parameter name Description
checksum true if checksum should be added to barcode; otherwise, false.
checksumToCaption true if checksum should be added to barcode caption; otherwise, false.
extraCaption The additional barcode caption text to draw.
extraCaptionFont The additional barcode caption font. Please use TypeConverter object for encoding.
  Copy Code
TypeConverter tc = TypeDescriptor.GetConverter(typeof(Font)); tc.ConvertToString(aFont);
extraCaptionPos The barcode additional caption position. For possible values take a look at CaptionPosition
angle The barcode rotation angle. For possible values take a look at RotationAngle
back The color used to draw the barcode background. Please use TypeConverter object for encoding.
  Copy Code
TypeConverter tc = TypeDescriptor.GetConverter(typeof(Color)); tc.ConvertToString(aBackColor);
barHeight The height of the barcode bars in pixels.
captionFont The barcode caption font. Please use TypeConverter object for encoding.
  Copy Code
TypeConverter tc = TypeDescriptor.GetConverter(typeof(Font)); tc.ConvertToString(aFont);
captionPos The barcode caption position. For possible values take a look at CaptionPosition
caption The custom caption text to draw instead of the barcode encoded value.
drawCaption true if to draw the barcode encoded value; otherwise, false.
fore The color used to draw the barcode bars and caption(s). Please use TypeConverter object for encoding.
  Copy Code
TypeConverter tc = TypeDescriptor.GetConverter(typeof(Color)); tc.ConvertToString(aForeColor);
margins The barcode margins. Please use following syntax for encoding: [aLeft;aTop;aRight;aBottom].
narrowBarWidth The width of the narrow bar in pixels.
codabarCheckAlgo The algorithm to use for Codabar symbology checksum calculation. For possible values take a look at CodabarChecksumAlgorithm
codabarStop The symbol to use as stop symbol in Codabar symbology. For possible values take a look at CodabarSpecialSymbol
codabarStart The symbol to use as start symbol in Codabar symbology. For possible values take a look at CodabarSpecialSymbol
code128alphabet The alphabet to use for Code 128 symbology. For possible values take a look at Code128Alphabet
drawGap true if to draw intercharacter gaps; otherwise, false. Note that not all symbologies support this option.
showStartStop true if to show start and stop symbology symbols in caption text; otherwise, false. Note that not all symbologies support this option.
pdf417columnCount The minimum data column count for PDF417 barcodes.
pdf417errorLevel The error correction level to use for PDF417 barcodes.
textHint The barcode text rendering quality. For possible values take a look at TextRenderingHint
smoothing The barcode rendering quality. For possible values take a look at SmoothingMode
symbology The barcode symbology type. For possible values take a look at SymbologyType
value The barcode value to encode.
w2nRatio The width of a wide bar relative to the narrow bar.
halign The horizontal alignment of the barcode within the container. For possible values take a look at BarcodeHorizontalAlignment
valign The vertical alignment of the barcode within the container. For possible values take a look at BarcodeVerticalAlignment
format The output format of the barcode image. For possible values take a look at ImageFormat
width The width of output image in pixels.
height The height of output image in pixels.
key The key number part of registration information.
name The name part of the registration information.

Inheritance Hierarchy

System..::.Object
  System.Web.UI..::.Control
    System.Web.UI.WebControls..::.WebControl
      System.Web.UI.WebControls..::.Image
        Bytescout.BarCode..::.BarcodeWebImage

See Also