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

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -