Free Support Forum - aspose.com

Scanner can't read (Code39Standard) barcode

Hello. I have such task: need to create barcode which represent my code string. This string i receive in such way: Guid.NewGuid().ToString(“N”). Here is my code for creating and setting barcode image :


void MailMerge_MergeImageField(object sender, Aspose.Words.Reporting.MergeImageFieldEventArgs e)
{
using (BarCodeBuilder BarCodeGenerator = new BarCodeBuilder(StrBarCode, Symbology.Code39Standard))
{
// Set common properties
BarCodeGenerator.CaptionAbove = new Caption { Text = String.Empty, Visible = false };
BarCodeGenerator.CaptionBelow = new Caption { Text = String.Empty, Visible = false };
BarCodeGenerator.CodeLocation = CodeLocation.None;
BarCodeGenerator.GraphicsUnit = GraphicsUnit.Millimeter;
BarCodeGenerator.ImageQuality = ImageQualityMode.Default;
BarCodeGenerator.Margins = new MarginsF(0f, 0f, 0f, 0f);
BarCodeGenerator.Resolution = new Resolution(96f, 96f, ResolutionMode.Printer);

// Set size properties
BarCodeGenerator.AutoSize = false;
BarCodeGenerator.ImageHeight = 6;
BarCodeGenerator.ImageWidth = 38f;

BarCodeGenerator.BarHeight = 6;
BarCodeGenerator.BorderVisible = false;
Bitmap CodeImage = BarCodeGenerator.BarCodeImage;
e.Image = CodeImage;
}
}

Eventualy I get an image, but the scanner can not read it. And it does not matter what width of image I set : custom or default .
I’m sure that scanner works correct, because it is able to read other Code39 images. What is the problem?

Hi,

Thank you for inquiry.

The length of GUID string is large and the generated barcode cannot fit in 38 x 6 mm image. Could you please try the following alternates?

  1. Set auto size to true, so that the image size is always suitable for the barcode.
  2. The minimum width in which I was able to generated a barcode with xDimension=0.5 was 150mm.

As far as I know, every type of barcode has some zoom Coefficients bounduries.
Here is the link to an image of barcode in Code39
http://www.google.com.ua/imgres?q=Code+39&hl=uk&sa=X&biw=1440&bih=799&tbm=isch&prmd=ivns&tbnid=HWt1pAqOpbjG-M:&imgrefurl=http://www.activebarcode.com/codes/code39.html&docid=6iV18G1_H8nsYM&w=200&h=125&ei=nBZJTtanE8qs8QONpuGoBg&zoom=1&iact=rc&dur=343&page=1&tbnh=100&tbnw=160&start=0&ndsp=31&ved=1t:429,r:14,s:0&tx=90&ty=59
my scanner reads it perfactly. Why can't I create a barcode image (code 39) with such dimentions as image in the link.
Finaly I need to get a barcode image of Guid string and max width of my image must be not larger then 80 mm. How can I create such image using aspose? Maiby I should use other code standart? Can you advice me what kind?


Hi,

Yes, you are right, but 1D barcode size highly depends on the length of the codetext. In your example link, the image contains “CODE 39” data, which is very small size.

However, the size of GUID string is comparatively larger, e.g. I had “141D835F920D436DB010734034C7A704” generated at my end. This would result in larger barcode image (150 mm) with Code39Standard.

With Code128, the size was reduced to 100mm. Can you accommodate barcode image of this size?

A much better solution would be to use 2D barcodes like Pdf417, Datamatrix or others. A datamatrix barcode with codetext “141D835F920D436DB010734034C7A704” would easily fit in 15 x 15 mm. I would recommend in case your scanner can read 2D barcodes.