示例#1
0
    public int prCaptureMRZ()
    {
        try
        {
            /* Capturing images */
            //_pr.Capture();

            /* Getting the MRZ data */
            _doc = _pr.GetMrz(0, (int)PR_LIGHT.PR_LIGHT_INFRA, (int)PR_IMAGE_TYPE.PR_IT_ORIGINAL);

            if (!_doc.IsValid())
            {
                throw new NoDocumentFoundException("No MRZ data found");
            }
        }
        catch (gxException e)
        {
            return(_helper.GetErrorMessage(e, out _errorMessage));
        }
        catch (NoDocumentFoundException e)
        {
            _errorMessage = e.Message;
            return(1303);
        }
        catch (Exception e)
        {
            _errorMessage = e.Message + " --- prCaptureMRZ()";
            return(1305);
        }

        return(0);
    }
示例#2
0
    public int prGetMRZData(System.Collections.IList list)
    {
        try
        {
            if (_doc.IsValid())
            {
                string fieldName, text;
                int    j = "PR_DF_MRZ_".Length;
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                foreach (int i in Enum.GetValues(typeof(PR_DOCFIELD)))
                {
                    if (i <= (int)PR_DOCFIELD.PR_DF_MRZ_FIELDS)
                    {
                        continue;
                    }

                    fieldName = Enum.GetName(typeof(PR_DOCFIELD), i);
                    if (fieldName.StartsWith("PR_DF_MRZ_"))
                    {
                        text = _doc.Field(i);
                        text = text.Replace('<', ' ').Trim();
                        if (!string.IsNullOrEmpty(text))
                        {
                            text = fieldName.Substring(j).Replace('_', ' ') + ": " + text;
                            list.Add(text);
                        }
                    }
                }
            }
        }
        catch (gxException e)
        {
            return(_helper.GetErrorMessage(e, out _errorMessage));
        }
        catch (Exception e)
        {
            _errorMessage = e.Message + " --- prGetMRZData()";
            return(1305);
        }

        return(0);
    }
示例#3
0
    public int prCaptureBarcode()
    {
        try
        {
            /* Capturing images */
            //_pr.Capture();

            /* Reading barcode from infra image */
            _doc = _pr.GetBarcode(0, (int)PR_LIGHT.PR_LIGHT_INFRA, (int)PR_IMAGE_TYPE.PR_IT_ORIGINAL, 0, 0);

            if (!_doc.IsValid())
            {
                /* Reading barcode from white image */
                _doc = _pr.GetBarcode(0, (int)PR_LIGHT.PR_LIGHT_WHITE, (int)PR_IMAGE_TYPE.PR_IT_ORIGINAL, 0, 0);

                //                bool statusOk = _doc.FieldStatus((int)PR_DOCFIELD.PR_DF_BC1) == 0;
                //              if (!statusOk)
                //                _doc = _pr.GetBarcode(0, (int)PR_LIGHT.PR_LIGHT_UV, (int)PR_IMAGE_TYPE.PR_IT_ORIGINAL, 0, 0);
            }

            if (!_doc.IsValid())
            {
                throw new NoDocumentFoundException("No barcode found");
            }
        }
        catch (gxException e)
        {
            return(_helper.GetErrorMessage(e, out _errorMessage));
        }
        catch (NoDocumentFoundException e)
        {
            _errorMessage = e.Message;
            return(1303);
        }
        catch (Exception e)
        {
            _errorMessage = e.Message + " --- prCaptureBarcode()";
            return(1305);
        }

        return(0);
    }
示例#4
0
    public int prCaptureBarcode()
    {
        try
        {
            /* Capturing images */
            //_pr.Capture();

            /* Reading barcode from infra image */
            _doc = _pr.GetBarcode(0, (int)PR_LIGHT.PR_LIGHT_INFRA, (int)PR_IMAGE_TYPE.PR_IT_ORIGINAL, 0, 0);

            if (!_doc.IsValid())
            {
                /* Reading barcode from white image */
                _doc = _pr.GetBarcode(0, (int)PR_LIGHT.PR_LIGHT_WHITE, (int)PR_IMAGE_TYPE.PR_IT_ORIGINAL, 0, 0);

                //                bool statusOk = _doc.FieldStatus((int)PR_DOCFIELD.PR_DF_BC1) == 0;
                //              if (!statusOk)
                //                _doc = _pr.GetBarcode(0, (int)PR_LIGHT.PR_LIGHT_UV, (int)PR_IMAGE_TYPE.PR_IT_ORIGINAL, 0, 0);
            }

            if (!_doc.IsValid())
                throw new NoDocumentFoundException("No barcode found");
        }
        catch (gxException e)
        {
            return _helper.GetErrorMessage(e, out _errorMessage);
        }
        catch (NoDocumentFoundException e)
        {
            _errorMessage = e.Message;
            return 1303;
        }
        catch (Exception e)
        {
            _errorMessage = e.Message + " --- prCaptureBarcode()";
            return 1305;
        }

        return 0;
    }
    public int prCaptureMRZ()
    {
        try
        {
            /* Capturing images */
            //_pr.Capture();

            /* Getting the MRZ data */
            _doc = _pr.GetMrz(0, (int)PR_LIGHT.PR_LIGHT_INFRA, (int)PR_IMAGE_TYPE.PR_IT_ORIGINAL);

            if (!_doc.IsValid())
                throw new NoDocumentFoundException("No MRZ data found");
        }
        catch (gxException e)
        {
            return _helper.GetErrorMessage(e, out _errorMessage);
        }
        catch (NoDocumentFoundException e)
        {
            _errorMessage = e.Message;
            return 1303;
        }
        catch (Exception e)
        {
            _errorMessage = e.Message + " --- prCaptureMRZ()";
            return 1305;
        }

        return 0;
    }