示例#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
        private void scan_verso()
        {
            //PassportReader pr = new PassportReader();
            try
            {
                //pr.UseDevice(0, (int)PR_USAGEMODE.PR_UMODE_FULL_CONTROL);
                pr.Capture();


                if (File.Exists(Environment.ExpandEnvironmentVariables("%TEMP%\\") + "verso.jpeg"))
                {
                    File.Delete(Environment.ExpandEnvironmentVariables("%TEMP%\\") + "verso.jpeg");
                }
                pr.SaveImage(0, (int)PR_LIGHT.PR_LIGHT_WHITE, (int)PR_IMAGE_TYPE.PR_IT_DOCUMENT, Environment.ExpandEnvironmentVariables("%TEMP%/") + "verso.jpeg", (int)GX_IMGFILEFORMATS.GX_JPEG);

                prDoc   doc = pr.Recognize(0);
                gxImage img = doc.FieldImage((int)PR_DOCFIELD.PR_DF_VIZ_FACE);
                if (img != null)
                {
                    if (File.Exists(Environment.ExpandEnvironmentVariables("%TEMP%\\") + "PhotoIdentite.jpeg"))
                    {
                        File.Delete(Environment.ExpandEnvironmentVariables("%TEMP%\\") + "PhotoIdentite.jpeg");
                    }
                    img.Save(Environment.ExpandEnvironmentVariables("%TEMP%\\") + "PhotoIdentite.jpeg", (int)GX_IMGFILEFORMATS.GX_JPEG);
                }

                string temp;
                temp = doc.Field((int)PR_DOCFIELD.PR_DF_MRZ1) + doc.Field((int)PR_DOCFIELD.PR_DF_MRZ2) + doc.Field((int)PR_DOCFIELD.PR_DF_MRZ3);
                if (!temp.Equals(""))
                {
                    MRZ = temp;
                }
                else
                {
                    Program.LogFich.Info("[ScannerPiece] pas de piste MRZ sur le verso");
                }
            }
            catch (Exception ex)
            {
                Program.LogFich.Error("[ScannerPiece] n'a pas pu lire le verso du document : " + ex.ToString());
            }
            finally
            {
                //pr.CloseDevice();
                //pr.Close();
                //pr.Dispose();
                //pr = null;
            }
        }
示例#3
0
    public int prReleaseDocument()
    {
        try
        {
            if (_doc != null && _doc.IsValid())
            {
                _doc.Free();
                _doc = null;
            }
        }
        catch (Exception e)
        {
            _errorMessage = e.Message + " --- prReleaseDocument()";
            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);
    }
示例#5
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 prReleaseDocument()
    {
        try
        {
            if (_doc != null && _doc.IsValid())
            {
                _doc.Free();
                _doc = null;
            }
        }
        catch (Exception e)
        {
            _errorMessage = e.Message + " --- prReleaseDocument()";
            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;
    }