| |
 |
Generate Linear, 2D and Postal Barcodes |
 |
This is a simple demo that generates a BarCode of selected Symbology Type.
You can set the CodeText using the textbox provided on the webpage and generate the BarCode.
You can right click on the image and save in your local disk.
For more details please see the following topics:
| ASP.NET |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
<%@ page language="c#" masterpagefile="~/tpl/Demo.Master" inherits="NewOnline.CodeTextDemo, App_Web_tuwfkfry" title="Generate Linear, 2D and Postal Barcodes" %>
<%@ Register TagPrefix="cc1" Namespace="Aspose.BarCode.Web.UI" Assembly="Aspose.BarCode" %>
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
<table width="90%" align="center" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="19"><img src="/Common/images/heading_lft.jpg" alt="" width="19" height="41" /></td>
<td width="100%" class="demos-heading-bg"><h2 class="demos-heading-bg" style="text-align: left">Generate Linear, 2D and Postal Barcodes</h2></td>
<td width="19"><img src="/Common/images/heading_rt.jpg" alt="" width="19" height="41" /></td>
</tr>
</table>
<br />
<p class="componentDescriptionTxt" style="text-align: left">
This is a simple demo that generates a BarCode of selected Symbology Type.
You can set the CodeText using the textbox provided on the webpage and generate the BarCode.
You can right click on the image and save in your local disk.<br/><br/>For more details please see the following topics:
</p>
<ul>
<li style="text-align: left">
<a href="http://www.aspose.com/documentation/.net-components/aspose.barcode-for-.net/set-code-text-for-barcode.html">Set Code Text for BarCode</a>
</li>
<li style="text-align: left">
<a href="http://www.aspose.com/documentation/.net-components/aspose.barcode-for-.net/specify-symbologies-for-barcodes.html">Specify Symbologies for BarCode</a>
</li>
<li style="text-align: left">
<a href="http://www.aspose.com/documentation/.net-components/aspose.barcode-for-.net/save-barcode-images-to-different-formats.html">Save BarCode Images to Different Formats</a>
</li>
</ul>
<table class="genericTable">
<tr>
<td height="26" align="left">
</td>
<td height="26" align="left">
</td>
</tr>
<tr>
<td height="26" align="left">
Symbology Type:</td>
<td height="26" align="left">
<asp:DropDownList ID="ddlSymbology" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td height="26" align="left">
Code Text:</td>
<td height="26" align="left">
<asp:TextBox id="txtCode" runat="server">01234567890</asp:TextBox>
</td>
</tr>
<tr>
<td height="26" colspan="2">
<asp:Button id="btnSet" runat="server" Text="Update Barcode Image"
Width="171px" onclick="btnSet_Click"></asp:Button>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<p>
<cc1:BarCodeWebControl ID="BarCodeWebControl1" runat="server" />
</p>
</td>
</tr>
</table>
</asp:Content>
|
| C# |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
using System.Web.UI;
using Aspose.BarCode;
using Aspose.BarCode.Web.UI;
namespace NewOnline
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public partial class CodeTextDemo : Page
{
// Fields
// Methods
protected void btnSet_Click(object sender, EventArgs e)
{
// Set the CodeText and Symbology of the BarCode web control
this.BarCodeWebControl1.CodeText = this.txtCode.Text;
this.BarCodeWebControl1.SymbologyType = (Symbology)Enum.Parse(typeof(Symbology), ddlSymbology.SelectedValue);
}
private void InitializeComponent()
{
this.btnSet.Click += new EventHandler(this.btnSet_Click);
base.Load += new EventHandler(this.Page_Load);
}
protected override void OnInit(EventArgs e)
{
this.InitializeComponent();
base.OnInit(e);
LoadSymbologies();
}
private void LoadSymbologies()
{
Array arrSymbologies = Enum.GetValues(typeof(Symbology));
ddlSymbology.DataSource = arrSymbologies;
ddlSymbology.DataBind();
}
protected void Page_Load(object sender, EventArgs e)
{
// If page is loaded first time, set BarCode web control properties
if (!base.IsPostBack)
{
ddlSymbology.SelectedValue = Symbology.Code128.ToString();
// Set default Symbology Type
this.BarCodeWebControl1.SymbologyType = Symbology.Code128;
// Set CodeText
this.BarCodeWebControl1.CodeText = "01234567890";
// Hide borders
this.BarCodeWebControl1.BorderVisible = false;
// Set bar height
this.BarCodeWebControl1.BarHeight = 15f;
// Set x Dimension
this.BarCodeWebControl1.xDimension = 0.6f;
}
}
}
}
|
|
|
|