前一段时间escontrei这个图书馆" https://sites.google.com/site/aspfpdf/tutorials" - 基于FPDF,php,但是面对ASP,我使用它来安装银行,但是在尝试安装函数来设置条形码时面临以下问题。
下面是代码FPDF!
this.Codabar=function Codabar(xpos, ypos, code) {
var start='A';
var end='A';
var basewidth=0.35;
var height=16;
barChar = array (
'0' = array (6.5, 10.4, 6.5, 10.4, 6.5, 24.3, 17.9),
'1' = array (6.5, 10.4, 6.5, 10.4, 17.9, 24.3, 6.5),
'2' = array (6.5, 10.0, 6.5, 24.4, 6.5, 10.0, 18.6),
'3' = array (17.9, 24.3, 6.5, 10.4, 6.5, 10.4, 6.5),
'4' = array (6.5, 10.4, 17.9, 10.4, 6.5, 24.3, 6.5),
'5' = array (17.9, 10.4, 6.5, 10.4, 6.5, 24.3, 6.5),
'6' = array (6.5, 24.3, 6.5, 10.4, 6.5, 10.4, 17.9),
'7' = array (6.5, 24.3, 6.5, 10.4, 17.9, 10.4, 6.5),
'8' = array (6.5, 24.3, 17.9, 10.4, 6.5, 10.4, 6.5),
'9' = array (18.6, 10.0, 6.5, 24.4, 6.5, 10.0, 6.5),
'$' = array (6.5, 10.0, 18.6, 24.4, 6.5, 10.0, 6.5),
'-' = array (6.5, 10.0, 6.5, 24.4, 18.6, 10.0, 6.5),
':' = array (16.7, 9.3, 6.5, 9.3, 16.7, 9.3, 14.7),
'/' = array (14.7, 9.3, 16.7, 9.3, 6.5, 9.3, 16.7),
'.' = array (13.6, 10.1, 14.9, 10.1, 17.2, 10.1, 6.5),
'+' = array (6.5, 10.1, 17.2, 10.1, 14.9, 10.1, 13.6),
'A' = array (6.5, 8.0, 19.6, 19.4, 6.5, 16.1, 6.5),
'T' = array (6.5, 8.0, 19.6, 19.4, 6.5, 16.1, 6.5),
'B' = array (6.5, 16.1, 6.5, 19.4, 6.5, 8.0, 19.6),
'N' = array (6.5, 16.1, 6.5, 19.4, 6.5, 8.0, 19.6),
'C' = array (6.5, 8.0, 6.5, 19.4, 6.5, 16.1, 19.6),
'*' = array (6.5, 8.0, 6.5, 19.4, 6.5, 16.1, 19.6),
'D' = array (6.5, 8.0, 6.5, 19.4, 19.6, 16.1, 6.5),
'E' = array (6.5, 8.0, 6.5, 19.4, 19.6, 16.1, 6.5));
this.SetFont('Arial','',13);
this.Text(xpos, ypos + height + 4, code);
this.SetFillColor(0);
code = strtoupper(start.code.end);
for(i=0; i<strlen(code); i++){
char = code[i];
if(!isset(barChar[char])){
this.Error('Invalid character in barcode: '.char);
}
seq = barChar[char];
for(bar=0; bar<7; bar++){
lineWidth = basewidth*seq[bar]/6.5;
if(bar % 2 == 0){
this.Rect(xpos, ypos, lineWidth, height, 'F');
}
xpos += lineWidth;
}
xpos += basewidth*10.4/6.5;
}
}
PDF文档 - 很好
pdf.SetXY 60,260
pdf.Codabar 80,40,strCodigoBarras,0,0
ERRO Microsoft JScript运行时错误&#39; 800a138f&#39;
预期对象
/exec/boleto/fpdf.asp,第2679行 - &gt;这一行,文件中没有这个
答案 0 :(得分:0)
this.Codabar=function Codabar(xpos, ypos, codice) {
var basewidth=0.35;
var height=16;
var barChar=new Array();
barChar['0'] = new Array (6.5, 10.4, 6.5, 10.4, 6.5, 24.3, 17.9);
barChar['1'] = new Array (6.5, 10.4, 6.5, 10.4, 17.9, 24.3, 6.5);
barChar['2'] = new Array (6.5, 10.0, 6.5, 24.4, 6.5, 10.0, 18.6);
barChar['3'] = new Array (17.9, 24.3, 6.5, 10.4, 6.5, 10.4, 6.5);
barChar['4'] = new Array (6.5, 10.4, 17.9, 10.4, 6.5, 24.3, 6.5);
barChar['5'] = new Array (17.9, 10.4, 6.5, 10.4, 6.5, 24.3, 6.5);
barChar['6'] = new Array (6.5, 24.3, 6.5, 10.4, 6.5, 10.4, 17.9);
barChar['7'] = new Array (6.5, 24.3, 6.5, 10.4, 17.9, 10.4, 6.5);
barChar['8'] = new Array (6.5, 24.3, 17.9, 10.4, 6.5, 10.4, 6.5);
barChar['9'] = new Array (18.6, 10.0, 6.5, 24.4, 6.5, 10.0, 6.5);
barChar['$'] = new Array (6.5, 10.0, 18.6, 24.4, 6.5, 10.0, 6.5);
barChar['-'] = new Array (6.5, 10.0, 6.5, 24.4, 18.6, 10.0, 6.5);
barChar[':'] = new Array (16.7, 9.3, 6.5, 9.3, 16.7, 9.3, 14.7);
barChar['/'] = new Array (14.7, 9.3, 16.7, 9.3, 6.5, 9.3, 16.7);
barChar['.'] = new Array (13.6, 10.1, 14.9, 10.1, 17.2, 10.1, 6.5);
barChar['+'] = new Array (6.5, 10.1, 17.2, 10.1, 14.9, 10.1, 13.6);
barChar['A'] = new Array (6.5, 8.0, 19.6, 19.4, 6.5, 16.1, 6.5);
barChar['T'] = new Array (6.5, 8.0, 19.6, 19.4, 6.5, 16.1, 6.5);
barChar['B'] = new Array (6.5, 16.1, 6.5, 19.4, 6.5, 8.0, 19.6);
barChar['N'] = new Array (6.5, 16.1, 6.5, 19.4, 6.5, 8.0, 19.6);
barChar['C'] = new Array (6.5, 8.0, 6.5, 19.4, 6.5, 16.1, 19.6);
barChar['*'] = new Array (6.5, 8.0, 6.5, 19.4, 6.5, 16.1, 19.6);
barChar['D'] = new Array (6.5, 8.0, 6.5, 19.4, 19.6, 16.1, 6.5);
barChar['E'] = new Array (6.5, 8.0, 6.5, 19.4, 19.6, 16.1, 6.5);
this.SetFont('Arial','',13);
this.Text(xpos, ypos + height + 4, codice);
this.SetFillColor(0);
codice = 'A'+codice.toUpperCase()+'A';
for(i=0; i<codice.length; i++){
char = codice.charAt(i);
if (typeof barChar[char] === 'undefined') {
this.Error('Invalid character in barcode: '+char);
}
seq = barChar[char];
for(bar=0; bar<7; bar++){
lineWidth = basewidth*seq[bar]/6.5;
if(bar % 2 == 0){
this.Rect(xpos, ypos, lineWidth, height, 'F');
}
xpos += lineWidth;
}
xpos += basewidth*10.4/6.5;
}
}