Itextsharp barcode -
i try create pdf ean13 bar-code itextsharp library try generate barcode value "023942432852".
itextsharp.text.image imageean = codeean.createimagewithbarcode(cb, null, null);
return me system.indexoutofrangeexception
.
there code:
document pdfdoc = new document(pagesize, _margsx, _margdx, _margup, _margbo); pdfwriter writer = pdfwriter.getinstance(pdfdoc, new filestream(_path + @"\barcode.pdf", filemode.create)); pdfdoc.open(); pdfcontentbyte cb = writer.directcontent; pdfdoc.pagesize.backgroundcolor = basecolor.gray; barcodeean codeean = new barcodeean(); if (creachecksum) codeean.generatechecksum = true; codeean.checksumtext = true; codeean.codetype = barcode.ean13; codeean.code = barcode; itextsharp.text.image imageean = codeean.createimagewithbarcode(cb, null, null); imageean.scaleabsolute(100, 40); imageean.setabsoluteposition(pdfdoc.pagesize.right - 150f, pdfdoc.pagesize.bottom + 30f); pdfdoc.add(imageean);
as name indicates ean13 bar code requires 13 digits, ean8 bar code requires 8 digits. trying create bar code string
:
"023942432852"
when count number of digits in string
, find 12. 1 digit missing. please complete string
length 13.
Comments
Post a Comment