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; } }
public int prGetBarcodeImage(out byte[] buff) { buff = null; try { if (_doc.IsValid()) { /* Creating a barcode image */ gxImage img = _doc.FieldImage((int)PR_DOCFIELD.PR_DF_BC1); if (img.IsValid()) { buff = img.SaveToMem((int)GX_IMGFILEFORMATS.GX_JPEG); } } } catch (Exception e) { _errorMessage = e.Message + " --- prGetBarcodeImage()"; return(1305); } return(0); }