title: EGENERATE_IMAGE-2: Image size specified not large enough to draw image Error while printing barcode with more different values
body: <p>I am experiencing a serious issue that one of my clients has to print barcodes for products when a purchase is made. I made an application with the feature that the application will automatically print barcodes in the specified size and location in A4 size barcode sheet after saved. Then the issue occurs when product quantity becomes a large quantity like above 60.</p>
  
  <p>Exact exception message looks like this: </p>
  
  <pre><code>{System.Exception: EGENERATE_IMAGE-2: Image size specified not large enough to draw image. (Bar size determined to be less than 1 pixel)
     at BarcodeLib.Barcode.Generate_Image() in D:\WindowsProjects\InventorySoftware\SIS_1\BarcodeLib\BarcodeLib.cs:line 559
     at BarcodeLib.Barcode.Encode() in D:\WindowsProjects\InventorySoftware\SIS_1\BarcodeLib\BarcodeLib.cs:line 459
     at BarcodeLib.Barcode.Encode(TYPE iType) in D:\WindowsProjects\InventorySoftware\SIS_1\BarcodeLib\BarcodeLib.cs:line 341
     at BarcodeLib.Barcode.Encode(TYPE iType, String StringToEncode) in D:\WindowsProjects\InventorySoftware\SIS_1\BarcodeLib\BarcodeLib.cs:line 332
     at BarcodeLib.Barcode.Encode(TYPE iType, String StringToEncode, Int32 Width, Int32 Height) in D:\WindowsProjects\InventorySoftware\SIS_1\BarcodeLib\BarcodeLib.cs:line 291
     at SIS.BarcodePrintA4.barcodeGenerate() in D:\WindowsProjects\PAMCo_SYSBILL\SIS_1\SIS\Classes\General\BarcodePrintA4.cs:line 164}"
  </code></pre>
  
  <hr>
  
  <pre><code>Image barcodeImage;
      private void barcodeGenerate()
      {
  
          int W = 100;
          int H = 15;
  
      try
          {
              if (type != BarcodeLib.TYPE.UNSPECIFIED)
              {                    
  
                  barcodeImage = b.Encode(type, Barcode, W, H);            
  
          }
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message);
          }
      }
  
  
   public Image BarcodeImage(int ProductId)
      {
  
          if (ProductId &gt; 0)
          {
              PurchaseMasterDA purchaseMasterDA = new PurchaseMasterDA();
              productDA productDA = new productDA();
              DataTable dtbl = new DataTable();
              dtbl = productDA.Product(ProductId);
              CompanyName = purchaseMasterDA.CompanyName();
              if (dtbl.Rows.Count &gt;= 1)
              {
                  ProductName = dtbl.Rows[0]["productName"].ToString();
                  MRP = dtbl.Rows[0]["mrp"].ToString();
                  WholeSaleRate = dtbl.Rows[0]["wholeSaleRate"].ToString();
                  Barcode = dtbl.Rows[0]["productCode"].ToString();
              }
              barcodeGenerate();
              //ToImageAndPrint();
          }
  
          return barcodeImage;
      }
  
       barcodeImage = Bp.BarcodeImage(int.Parse(dtBarcodeDetails.Rows[iRows]["ProductID1"].ToString() == "" ? "0" : dtBarcodeDetails.Rows[iRows]["ProductID1"].ToString()));
                  graphics.DrawImage(barcodeImage, loc1);
                  Rs1 = "Rs ";
  </code></pre>