Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
795
Reading barcode from tiff file returns empty string
posted

Hi,

Reading from Tiff file

----------------------------

I am trying to read barcode from multipage file, but it is returning empty string after reading the tiff file. I have attached both code I am using and till file with this post. Please advise me why it is not able to read the barcodes from tiff file.

Reading from Pdf file

-----------------------------

Apart form tiff, I want to read barcodes from pdf files also. Please advise me what APIs are provided by infragistics to read barcodes from pdf file. Please throw some code samples for reading barcode from pdf files.

The below code is to read barcode from tiff file.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

using

 

 

 

System;

using

 

 

 

System.Collections.Generic;

using

 

 

 

System.Linq;

using

 

 

 

System.Text;

using

 

 

 

System.IO;

using

 

 

 

System.Windows.Media.Imaging;

//using System.Drawing;

using

 

 

 

System.Windows;

using

 

 

 

System.Windows.Controls;

//using System.Windows.Media;

using

 

 

 

Infragistics.Controls.Barcodes;

namespace

 

 

 

ConsoleApplication1

{

 

 

 

class

Program

{

 

 

 

static void Main(string

[] args)

{

 

 

 

Stream imageStreamSource = new FileStream(@"C:\Data\Srirangam\test.tif", FileMode.Open, FileAccess.Read, FileShare

.Read);

 

 

 

TiffBitmapDecoder decoder = new TiffBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption

.Default);

 

 

 

BitmapSource

bitmapSource = decoder.Frames[1];

 

 

 

BarcodeReader barReader = new BarcodeReader

();

barReader.BarcodeOrientation =

 

 

SymbolOrientation

.Unspecified;

barReader.MaxNumberOfSymbolsToRead = 5;

barReader.DecodeComplete +=

 

 

new EventHandler<ReaderDecodeArgs

>(barReader_DecodeComplete);

barReader.Decode(bitmapSource,

 

 

Symbology

.All);

 

 

 

}

 

 

 

static void barReader_DecodeComplete(object sender, ReaderDecodeArgs

e)

{

 

 

 

String

barValue = e.Value;

 

 

 

Console

.WriteLine(barValue);

 

 

 

}

}

}

Regards

Uthay

test.zip
  • 138253
    Offline posted

    Hello Uthay,

     

    Thank you for your post. I have been looking into it and I can say that the Barcode Reader can read .JPEG and .PNG files. Here you can read more about the Reader:

     

    http://help.infragistics.com/doc/WPF/2013.2/CLR4.0/?page=IG_Barcode_Reader.html

     

    and in the Feature Browser under Infragistics Barcode Reader / Key Features / Reader Settings section you can see how to decode pictures.

     

    Feel free to write me if you have further questions.