コードコピーは次のとおりです。
<title> barcode generation </title>
<%
Rem ==================================================================================================================
rem = function:ean13
REM =説明:例(ASPコード)を使用してEAN13標準バーコードを生成します
REM =バージョン:1.0.0
rem =著者:7番目の直角(7番目/semico)
REM =日付:2005-08-08 11:57:06
REM = QQ:11110785
REM = QQグループ:3773360
REM =該当する:必要に応じてEAN13標準バーコードを生成します
Rem ==================================================================================================================
関数ean13(code、w、h)
Dim Guide、Dict、Lencode、Rencode、cstart、cmid、cend、barcode、lmethod
Guide = array( "aaaaaaaa"、 "aababb"、 "aabbab"、 "abaabb"、 "abbaab"、 "abbbaa"、 "ababab"、 "ababab"、 "ababba"、 "abbaba"))
set dict = createObject( "Scripting.Dictionary")
dict.add "a"、 "00011010011001001001111010101000110101010101101101101101101101101101100010111"
dict.Add "B"、 "01001110110011011010100001001001110110110010010010010010010010010010010111"
rencode = array( "1110010"、 "1100110"、 "1101100"、 "1000010"、 "1011100"、 "10011100"、 "1010000"、 "10001000"、 "11101000")
cstart = "101"
cmid = "01010"
cend = "101"
w <2の場合、w = 2
h <20の場合、h = 20
cwidth = w'barcodeユニット幅
cheight = h'barcode height
'バーコードが標準を満たしているかどうかを確認してください
len(code)<> 13の場合、response.write "は13ビットでなければなりません!":respons.end
i = 1から12の場合
is -numeric(mid(code、i、1))の場合
2をmod 2にしてください
rsum = rsum+int(mid(code、i、1))
それ以外
lsum = lsum+int(mid(code、i、1))
ifを終了します
それ以外
response.write「デジタルコードである必要があります!」:Response.End
ifを終了します
次
if 10 - ((lsum*3+rsum)mod 10)<> int(right(code、1))then respons.write "このバーコードは間違っています!":respons.end.end
'バーコードを変換します
barcode = cstart
lmethod = left(code、1)
'lmethod = 0の場合、lmethod = 1
i = 2〜7の場合
barcode = barcode&mid(dict(mid(guide(lmethod-1)、i-11))、(7*mid(code、i、1)+1)、7)
次
barcode = barcode&cmid
i = 8〜13の場合
barcode = barcode&rencode(mid(code、i、1))
次
barcode = barcode&cend
fg = "#000000" '前景色のバーコード
bg = "#ffffff" 'バーコードの背景色
respons.write "<div style = 'position:absolute; width:"&cwidth*95+60& "px; height:"&cheight+30& "px;背景:"&bg& ";'>"
'バーコードを描きます
x = 1の場合(バーコード)
x <5またはx> 92または(x> 46およびx <51)の場合
sh = 10
それ以外
sh = 0
ifを終了します
mid(barcode、x、1)= "1" thenの場合
bcolor = fg
それ以外
bcolor = bg
ifを終了します
Response.Write "<div style = 'position:absolute; left:"&(x-1)*cwidth+30& "px; top:5px; width:"&cwidth& "px; height:"&cheight+5+sh& "px;