Preguntas frecuentes sobre TBarCode .NET
¿Cómo puedo crear un mapa de bits legible de Code 39?
¿Cómo puedo crear un mapa de bits legible de Code 39?
El siguiente código de ejemplo en ASP.NET genera una imagen Code 39.
//Code 39 Barcode barcode = new Barcode(); barcode.Data = "10030000007611107871900002199908"; barcode.BarcodeType = BarcodeType.Code39; // with dpi = 100 we get 1 Pixel = 0.254 mms barcode.Dpi = 100; // bar code size should adapt to bounding rectangle barcode.SizeMode = SizeMode.FitToBoundingRectangle; // set default size of symbol (define the default height) barcode.BoundingRectangle = new Rectangle(0, 0, 254, 100 /* = 1 inch */); // now calculate optimal bitmap size for the bar code Size optimalSize = barcode.CalculateOptimalBitmapSize(null, 1, 1); // update rectangle to optimized size barcode.BoundingRectangle = new Rectangle(0, 0, optimalSize.Width, optimalSize.Height); barcode.Draw(filename, ImageType.Jpg);