İnternetten yaptığım araştırmalara göre bu barkod hakkında kullandığım siteleri sonra kendim tekrar bulmakta zorlanmayayım diye buraya yazıyorum,
- Benim kullanmayı düşündüğüm ulgulama;
http://www.aspindir.com/goster/3310 buradaki kodlar çalışıyo denedim. Kodu incelediğinizde istenen barkodu adrese
code128a.aspx?input=deneme şeklinde yazarsanız istediğiniz verinin barkodu oluşuyor. Yapılmış örnekte değişiklikler yapılarak uygulanabilir.
code128a.aspx ‘in içeriği
<%@ Import Namespace=”System.Drawing” %>
<%@ Import Namespace=”System.Drawing.Imaging” %><script language=”VB” runat=”server”>
<%@ Import Namespace=”System.Drawing.Imaging” %><script language=”VB” runat=”server”>
Sub BarCode(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Input As String = Request.Querystring(“input”)
If Input = “” Then Input = “barkodyaz”
Dim ValidInput As String = ” !” & Chr(34) & “#$%&()**+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~” & Chr(0) & Chr(1) & Chr(2) & Chr(3) & Chr(4) & Chr(5) & Chr(6) & Chr(7) & Chr(8) & Chr(9) & Chr(10) & Chr(255)
Dim ValidCodes As String = “17401644163811761164110012241220112416081604157214361244123014841260125416501628161417641652190218681836183018921844184217521734159013041112109414161128112216721576157014641422113414961478114219101678158217681762177418801862181418961890181819141602193013281292120011581068106214241412123212181076107415541616197815561146134012121182150812681266195619401938175817821974140013101118151215061960195415021518188619661724168016926379”
Dim Digit As Integer = 103
Dim i As Integer
For i = 1 to Input.Length
Digit += (i * Instr(1, ValidInput, Mid(Input, i, 1)))
Next
Digit = Digit Mod 103
Input = Chr(8) & Input & Mid(ValidInput, Digit, 1) & Chr(255)
Dim bmp As Bitmap = New Bitmap((Input.Length * 11) + 13, 50)
Dim g As Graphics = Graphics.FromImage(bmp)
g.FillRectangle(New SolidBrush(Color.White), 0, 0, (Input.Length * 11) + 13, 50)
Dim p As New Pen(Color.Black, 1)
Dim BarValue, BarX As Integer
Dim BarSlice As Short
For i = 1 To Input.Length
Try
If InStr(1, ValidInput, Mid(Input, i, 1)) > 0 Then
BarValue = Val(Mid(ValidCodes, ((InStr(1, ValidInput, Mid(Input, i, 1)) – 1) * 4) + 1, 4))
Digit = 11
If i = Input.Length Then Digit = 13
For BarSlice = Digit To 0 Step -1
If BarValue >= 2 ^ BarSlice Then
g.DrawLine(p, BarX, 0, BarX, 50)
BarValue = BarValue – (2 ^ BarSlice)
End If
BarX += 1
Next
Else
Response.Write(“Invalid input”)
Response.End
End If
Catch
End Try
Next
Response.ContentType = “image/gif”
bmp.Save(Response.OutputStream, ImageFormat.GIF)
g.Dispose()
bmp.Dispose()
End Sub
Dim Input As String = Request.Querystring(“input”)
If Input = “” Then Input = “barkodyaz”
Dim ValidInput As String = ” !” & Chr(34) & “#$%&()**+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~” & Chr(0) & Chr(1) & Chr(2) & Chr(3) & Chr(4) & Chr(5) & Chr(6) & Chr(7) & Chr(8) & Chr(9) & Chr(10) & Chr(255)
Dim ValidCodes As String = “17401644163811761164110012241220112416081604157214361244123014841260125416501628161417641652190218681836183018921844184217521734159013041112109414161128112216721576157014641422113414961478114219101678158217681762177418801862181418961890181819141602193013281292120011581068106214241412123212181076107415541616197815561146134012121182150812681266195619401938175817821974140013101118151215061960195415021518188619661724168016926379”
Dim Digit As Integer = 103
Dim i As Integer
For i = 1 to Input.Length
Digit += (i * Instr(1, ValidInput, Mid(Input, i, 1)))
Next
Digit = Digit Mod 103
Input = Chr(8) & Input & Mid(ValidInput, Digit, 1) & Chr(255)
Dim bmp As Bitmap = New Bitmap((Input.Length * 11) + 13, 50)
Dim g As Graphics = Graphics.FromImage(bmp)
g.FillRectangle(New SolidBrush(Color.White), 0, 0, (Input.Length * 11) + 13, 50)
Dim p As New Pen(Color.Black, 1)
Dim BarValue, BarX As Integer
Dim BarSlice As Short
For i = 1 To Input.Length
Try
If InStr(1, ValidInput, Mid(Input, i, 1)) > 0 Then
BarValue = Val(Mid(ValidCodes, ((InStr(1, ValidInput, Mid(Input, i, 1)) – 1) * 4) + 1, 4))
Digit = 11
If i = Input.Length Then Digit = 13
For BarSlice = Digit To 0 Step -1
If BarValue >= 2 ^ BarSlice Then
g.DrawLine(p, BarX, 0, BarX, 50)
BarValue = BarValue – (2 ^ BarSlice)
End If
BarX += 1
Next
Else
Response.Write(“Invalid input”)
Response.End
End If
Catch
End Try
Next
Response.ContentType = “image/gif”
bmp.Save(Response.OutputStream, ImageFormat.GIF)
g.Dispose()
bmp.Dispose()
End Sub
</script>
- Diğer bir örnek;
Bu kod biraz daha karışık kurcalandı mı çalışabilir ama benim işimi üstteki gördü.
- Son olarak kod yazmayı sevmeyenler için http://barcode.tec-it.com/ adresinde bulunan generator servisini kullanabilirsiniz. Sizin için otomatik üretip sonucu gösteriyor;
<table>
<tr>
<td>
<img src=”http://barcode.tec-it.com/barcode.ashx?code=Code128&modulewidth=fit&data=burayabarkodunuistediğinifadeyiyaz&dpi=96&imagetype=gif&rotation=0&color=&bgcolor=&fontcolor=&quiet=0&qunit=mm” alt=”Barkod TEC-IT üretiyor “/>
</td>
</tr>
</table>
<tr>
<td>
<img src=”http://barcode.tec-it.com/barcode.ashx?code=Code128&modulewidth=fit&data=burayabarkodunuistediğinifadeyiyaz&dpi=96&imagetype=gif&rotation=0&color=&bgcolor=&fontcolor=&quiet=0&qunit=mm” alt=”Barkod TEC-IT üretiyor “/>
</td>
</tr>
</table>
Hiç yorum yok :
Yorum Gönder