国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

生成EAN13標準的條形碼的ASP代碼實例

2024-05-04 11:01:15
字體:
來源:轉載
供稿:網友

復制代碼 代碼如下:
<title>條形碼生成</title>
<%
Rem =================================================================
Rem = 函數:ean13
Rem = 說明:生成EAN13標準的條形碼,有實例(ASP代碼)
Rem = 版本:1.0.0
Rem = 作者:第七種直角(7th/semico)
Rem = Date:2005-08-08 11:57:06
Rem = QQ:11110785
Rem = QQ群:3773360
Rem = 適用:按照需要生成EAN13標準的條形碼
Rem =================================================================
Function ean13(code,w,h)
 Dim Guide,Dict,Lencode,Rencode,cStart,cMid,cEnd,Barcode,Lmethod
 Guide = array("AAAAAA","AABABB","AABBAB","ABAABB","ABBAAB","ABBBAA","ABABAB","ABABBA","ABBABA")

 Set Dict = CreateObject("Scripting.Dictionary")
 Dict.Add "A", "0001101001100100100110111101010001101100010101111011101101101110001011"
 Dict.Add "B", "0100111011001100110110100001001110101110010000101001000100010010010111"

 Rencode = array("1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100")

 cStart="101"
 cMid="01010"
 cEnd="101"

 if w<2 then w=2
 if h<20 then h=20
 cWidth=w '條碼單元寬度
 cHeight=h '條碼高度

 '檢驗條碼是否符合標準
 if len(code)<>13 then response.write "必須為13位!":response.end

 for i=1 to 12
  if IsNumeric(mid(code,i,1)) then
   if i mod 2 then
    rsum=rsum+int(mid(code,i,1))
   else
    lsum=lsum+int(mid(code,i,1))
   end if
  else
   response.write "必須為數字碼!":response.end
  end if
 next
 if 10-((lsum*3+rsum) mod 10) <> int(right(code,1)) then response.write "此條碼錯誤!":response.end

 

 '轉換條碼
 Barcode=cStart
 Lmethod=left(code,1)
 'if Lmethod=0 then Lmethod=1
 for i=2 to 7
  barcode = barcode & mid(Dict(Mid(Guide(Lmethod-1),i-1,1)),(7*mid(code,i,1)+1),7)
 next
 barcode=barcode & cMid
 for i=8 to 13
  barcode = barcode & Rencode(mid(code,i,1))
 next
 barcode=barcode & cEnd


 fg="#000000" '條碼前景色
 bg="#ffffff" '條碼背景色
 response.write "<div style='position:absolute;width:"&cWidth*95+60&"px; height:"&cHeight+30&"px; background:"&bg&";'>"
 '繪制條碼
 for x=1 to len(barcode)
  if x<5 or x>92 or (x>46 and x<51)then
   sh=10
  else
   sh=0
  end if

  if mid(barcode,x,1)="1" then
   bColor=fg
  else
   bColor=bg
  end if

  response.write "<div style='position:absolute;left:"&(x-1)*cWidth+30&"px;top:5px;width:"&cWidth&"px;height:"&cHeight+5+sh&"px;background:"&bColor&";'></div>"

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 保靖县| 塔河县| 凉城县| 古田县| 阜宁县| 秭归县| 康平县| 中山市| 八宿县| 平邑县| 怀来县| 邢台县| 香港 | 汪清县| 买车| 泽州县| 鸡泽县| 迁安市| 夹江县| 禹州市| 无极县| 桂东县| 莱西市| 集安市| 吴川市| 彝良县| 离岛区| 清水河县| 舞阳县| 铅山县| 新河县| 桃园市| 永寿县| 封开县| 桐庐县| 抚松县| 洪江市| 隆回县| 察雅县| 浪卡子县| 虎林市|