SmartCodeWebControl Programming
Measurements
SmartCodeWebControl allows you to work with different units, specifically twips (1/1400 inches), inches and millimeters. Simply choose the appropriate properties below to work with the specific units.
Properties in Twips
NarrowBarWidth
BoundaryZoneX
BoundaryZoneY
TextDistance
Properties in Inches
NarrowBarWidthInch
BoundaryZoneXInch
BoundaryZoneYInch
TextDistanceInch
Properties in Millimeters
NarrowBarWidthMilli
BoundaryZoneXMilli
BoundaryZoneYMilli
TextDistanceMilli
If you will like to convert between the different unitsin your programs, the following formulas can be used.
To convert Twips to Inches : variableInches=variableTwips/1440;
To convert Twips to Millimeters : variableMillimeters=(variableTwips/1440)*25.4;
To convert Millimeters to Twips : variableTwips=(variableMillimeters/25.4)*1440;
To convert Millimeters to Inches : variableInches=variableMillimeters/25.4;
To convert Inches to Millimeters : variableMillimeters=variableInches*25.4;
To convert Inches to Twips : variableTwips=variableInches*1440;
Streaming the Barcode Bitmap
How to save the Barcode Bitmap to the Reponse Object output stream?
C# Code
protected void Page_Load(object sender, EventArgs e)
{
TechnoRiver.SmartCodeWeb.SmartCodeWebControl sc = new TechnoRiver.SmartCodeWeb.SmartCodeWebControl();
//set up properties eg the Rotation could be setup below
//sc.Rotation=TechnoRiver.SmartCodeWeb.SmartCodeWebControl.BarcodeRotation.Rotate90;
sc.GetBitMap().Save(this.Context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
}
VB.Net Code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim sc As TechnoRiver.SmartCodeWeb.SmartCodeWebControl = New TechnoRiver.SmartCodeWeb.SmartCodeWebControl()
'sc.Rotation = TechnoRiver.SmartCodeWeb.SmartCodeWebControl.BarcodeRotation.Rotate90
sc.GetBitMap().Save(Me.Context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub
Saving the Barcode image on server
How to save the Barcode image on the server?
C# Code
protected void Page_Load(object sender, EventArgs e)
{
TechnoRiver.SmartCodeWeb.SmartCodeWebControl sc = new TechnoRiver.SmartCodeWeb.SmartCodeWebControl();
sc.SaveImage();
Response.Write("<img src=" + sc.BarcodeVirtualFileName + "/>");
}
VB.Net Code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim sc As TechnoRiver.SmartCodeWeb.SmartCodeWebControl sc = New TechnoRiver.SmartCodeWeb.SmartCodeWebControl() sc.SaveImage()
Response.Write("<IMG src= """ + sc.BarcodeVirtualFileName "" ">")
End Sub
Using SmartCodeWebControl as a ASP Web Control
See SimpleWebControl.aspx in the demo project.
How to use incoming paramters from the web to generate barcodes in SmartCodeWebControl?
See CodeBehindWithFormParameters.aspx,CodeBehindWithFormParameters.aspx.cs in the demo project.
|