Free Support Forum - aspose.com

Question About Demo Program

I have an image that I'm having troble with getting it to read a barcode correctly in my project.

Just to see what would happen I tried it with the demo program that comes with the download. Aspose.BarCode.Toolkit.exe

It didn't read it either at first but it does after the "Adjust resolution" button is pressed. Can you tell me exactly what it does to the image when it adjusts it? Or better yet is the source code for the demo program avaliable?

Hi,

Thank you for inquiry.

Could you please post the sample image here for our analysis?
I will check if we could get the source code of the barcode toolkit for you and inform you later.

Attached is an example that displays this behavior. Note the image is the result of the printed page being scanned into a processing program.

The code that created the barcode

pBarcode.xDimension = 4

pBarcode.CodeLocation = CodeLocation.None

pBarcode.SymbologyType = Symbology.DataMatrix

pBarcode.CodeText = pPageData.PageXMLString(pPageNumber).PadRight(300)

The code text (padded to 300 chars with spaces to make fixed size)

<?xml version="1.0" encoding="utf-16"?>

(It makes sence to the processing program....)

Then reading it back:

Using BarcodeScanner As New BarCodeReader(New Bitmap(Me.ImageDeliveryLog.PageImage), BarCodeReadType.DataMatrix)

With BarcodeScanner

While .Read()

Dim CodeText As String = .GetCodeText

If CodeText.IsNullOrEmpty = False Then

....

The “Adjust Resolution” button just re-sizes the loaded image, so that it is adjusted in the PictureBox control of the demo application.

int w = this.bm.Width;
int h = this.bm.Height;
Bitmap newBitmap = new Bitmap( w>h? w:h, w>h? w:h);
Graphics g = Graphics.FromImage(newBitmap);
g.DrawImageUnscaled(this.bm, 0, 0);
this.pictureBox1.Image = newBitmap;