EAN13 script
Dear people,
I saw an little javascript online to create an barcode with an font in an HTML file.
I thought I can do this with an acrobat form and the ean13 fonts only I'm very new to acrobat and Javascript.
This is what I have as validation script.
var gug = ["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]
function updatebarcode(){
var txt = this.getField("Text1").value
// Left Block
var first = txt[0]
var enc = "_"+first+"*"
var max = ((txt.length<7)? txt.length:7)
for(var i = 1;i< max;i++){
enc+=gug[first][i-1]+txt
}
enc+="**"
// Right Block
var max = ((txt.length<12)? txt.length:12)
for(var i = 7;i< max;i++){
enc+="R"+txt
}
pr = 0
//Checksum
for(var i= Math.min(txt.length,12);i>=1;i--){
pr+=parseInt(txt[i-1])*(i%2==1?1:3)
}
pr=(10-(pr%10))%10
enc+="R"+pr
enc+="*"
this.getField("Text1").value=enc
}
An barcode like this:
8711731130608
Should become this:
_8*L7G1L1G7G3L1**R1R3R0R6R0R8*
Is this possible?
