bardecode.com

  • Increase font size
  • Default font size
  • Decrease font size
Home Knowledge Base Performance issues using SkewTolerance

Performance issues using SkewTolerance

The SkewTolerance property is used for the detection of barcodes in skewed documents, but it can have a negative impact on the performance of the ScanBarCode command, especially when reading PDf-417 and Datamatrix barcodes. One solution to this problem is to use xml settings, which allow you to store sets of properties which are applied successively until a barcode is decoded.
 
For example, if you create a an xml file containing...
 
<xml version='1.0' encoding='iso-8859-1'>
        <SoftekBarcode>
                <Properties>
                        <ReadCode39>1</ReadCode39>
                        <ReadCode25>1</ReadCode25>
                        <ReadPDF417>1</ReadPDF417>
                        <ReadDataMatrix>1</ReadDataMatrix>
                        <MultipleRead>1</MultipleRead>
                        <ReadCode128>1</ReadCode128>
                        <ScanDirection>15</ScanDirection>
                        <MinLength>4</MinLength>
                        <MaxLength>999</MaxLength>
                        <ShowCheckDigit>1</ShowCheckDigit>
                        <SkewTolerance>0</SkewTolerance>
                </Properties>
                <Properties>
                        <SkewTolerance>5</SkewTolerance>
                </Properties>
        </SoftekBarcode>
</xml>

...and in your code replace the lines where you set the properties of the toolkit with one line:
 
barcode.LoadXMLSettings("settings.xml")
 
Then, when you call ScanBarCode, the toolkit will first apply tthe settings in the first section of the xml file and only set SkewTolerance to 5 if it wasn't able to read a barcode in the normal orientations.