title: iText for .NET barcode
body: <p>I try to create a PDF with a <strong>EAN13</strong> Bar-code using the iTextSharp library.
  I try to generate a  barcode with the value "<strong>023942432852</strong>". </p>
  
  <pre><code>iTextSharp.text.Image imageEAN = codeEan.CreateImageWithBarcode(cb, null, null);
  </code></pre>
  
  <p>throws <code>System.IndexOutOfRangeException</code>.</p>
  
  <p>There is the code: </p>
  
  <pre><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);
  </code></pre>