2D Barcode Tools for Crystal Reports > Reference

ASP.NET interface

The ASP.NET interface is provided by the files contained in the DLBC folder, consisting of:

DLBC2D.ASPX – the script pointed to by reports creating a barcode image
GLOBAL.ASAX – generic Run at server file
GLOBAL.VB – file for creating session state variables

The sample supplied create an instance of the dBarcode2D.Control image creator each time the script is accessed and then sets the properties most commonly used. Additional properties may be set in this code if required by adding lines to set the values of any of the properties defined in the Image Creator section above. Multiple scripts may be created by copying the dlbc.aspx file to different files names where multiple default barcode setups are required.

The properties that are likely to be changed in a report are passed to the ASP.NET script as parameters immediately after the page URL, eg.

http://localhost/dlbc2d/dlbc2d.aspx?CodeType=0&Mode=0&Xunit=20&BorderSize=4&Caption=12345

The first parameter is preceded by a ? symbol and subsequent parameters are separated from one another by & symbols.

The ASP.NET script collects these parameters and, along with any other image creator properties that are hard coded in the file, these are passed to an instance of dBarcode2D.Control. A barcode image is then obtained as a MemoryStream object using the Pic() method, eg.

Session(“ms”)=m_barcode.Pic(0)

which generates a Windows metafile image, or

Session(“ms”)=m_barcode.Pic(300)

which generates a Portable Network Graphic image with a pixel resolution of 300 dpi.

Finally the ASP.NET script returns the image to the report. If a Windows metafile image is being returned the content type must be set to “image/x-wmf” using

Response.ContentType =  “image/x-wmf”

While if a PNG is used the type must be  “image/x-png”

 

More:

The Java interface