新版本外国人永久居留身份证EST-100身份证阅读器接口更新

新版本外国人永久居留身份证EST-100身份证阅读器接口更新_第1张图片

新版本外国人永久居留身份证EST-100身份证阅读器接口更新_第2张图片

新版本外国人永久居留身份证EST-100身份证阅读器接口更新_第3张图片

以下是新版本外国人永久居留身份证读取C#代码:

     //身份证信息 *******************************************************************************************************
        private void button4_Click(object sender, EventArgs e)
{
if (FormIsOpenReader.IsOpenReader != 1)
{
    richTextBox_idCard_data.Text += "EST-100身份证读卡器连接失败,请先打开设备 \r\n";
    return;
}

int t_nRe = 99;
int t_nType = 1; //设置身份证读卡类型:0,文本信息;1,文本 + 照片;2,文本 + 照片 + 指纹,不读指纹读卡速度更快一些!
StringBuilder t_szPicPath = new StringBuilder("IDphoto.jpg"); //定义相片名称
StringBuilder t_arrChMsg = new StringBuilder(256);
IDINFO idInfo = new IDINFO(); //结构体
t_nRe = Donsee_ReadIDCard(t_nType, t_szPicPath, ref idInfo, t_arrChMsg); //注意结构体入参
if (t_nRe == 0)
{
    Donsee_Beep();
                if (idInfo.certType.ToString().Trim() == "I")//2017版外国人永居证
                {
                    richTextBox_idCard_data.Text += "读取成功,证件类型:2017版外国人永居证\r\n";
                    richTextBox_idCard_data.Text += "证件类型标识:" + idInfo.certType.ToString().Trim() + "\r\n";
                    richTextBox_idCard_data.Text += "英文姓名:" + idInfo.ENfullname + "\r\n";
                    richTextBox_idCard_data.Text += "性    别:" + idInfo.sex + "\r\n";
                    richTextBox_idCard_data.Text += "永居证号码:" + idInfo.number + "\r\n";
                    richTextBox_idCard_data.Text += "国籍:" + idInfo.people + idInfo.Nationality + "\r\n";
                    richTextBox_idCard_data.Text += "中文姓名:" + idInfo.name + "\r\n";
                    richTextBox_idCard_data.Text += "有效期开始:" + idInfo.signdate + "\r\n";
                    richTextBox_idCard_data.Text += "有效期结束:" + idInfo.validterm + "\r\n";
                    richTextBox_idCard_data.Text += "出生日期:" + idInfo.birthday + "\r\n";
                    richTextBox_idCard_data.Text += "证件版本号:" + idInfo.certVersion + "\r\n";
                    richTextBox_idCard_data.Text += "申请机关代码:" + idInfo.organs + "\r\n";
                    if (t_nType != 0)
                    {
                        richTextBox_idCard_data.Text += "照片原始数据:" + idInfo.Photo.Substring(0, 50) + "..\r\n";
                    }
                    //外国人永居证没有指纹数据
                }
                else if (idInfo.certType.ToString().Trim() == "J")//港澳台居民居住证
                {
                    richTextBox_idCard_data.Text += "读取成功,证件类型:港澳台通行证\r\n";
                    richTextBox_idCard_data.Text += "证件类型标识:" + idInfo.certType.ToString().Trim() + "\r\n";
                    richTextBox_idCard_data.Text += "姓名:" + idInfo.name + "\r\n";
                    richTextBox_idCard_data.Text += "性别:" + idInfo.sex + "\r\n";
                    richTextBox_idCard_data.Text += "出生日期:" + idInfo.birthday + "\r\n";
                    richTextBox_idCard_data.Text += "地址:" + idInfo.address + "\r\n";
                    richTextBox_idCard_data.Text += "港澳台居住证号码:" + idInfo.number + "\r\n";
                    richTextBox_idCard_data.Text += "签发机关:" + idInfo.organs + "\r\n";
                    richTextBox_idCard_data.Text += "有效期开始:" + idInfo.signdate + "\r\n";
                    richTextBox_idCard_data.Text += "有效期结束:" + idInfo.validterm + "\r\n";
                    richTextBox_idCard_data.Text += "通行证号码:" + idInfo.passNu + "\r\n";
                    richTextBox_idCard_data.Text += "签发次数:" + idInfo.signCount + "\r\n";
                    if (t_nType != 0)
                    {
                        richTextBox_idCard_data.Text += "照片原始数据:" + idInfo.Photo.Substring(0, 50) + "..\r\n";
                    }
                    if (t_nType == 2)
                    {
                        richTextBox_idCard_data.Text += "指纹原始数据:" + idInfo.figData.Substring(0, 50) + "..\r\n";
                    }
                }
                else if (idInfo.certType.ToString().Trim() == "Y")//新版外国人永居证

                {
                    richTextBox_idCard_data.Text += "读取成功,证件类型:新版外国人永居证\r\n";
                    richTextBox_idCard_data.Text += "证件标识:" + idInfo.certType.ToString().Trim() + "\r\n";
                    richTextBox_idCard_data.Text += "中文姓名:" + idInfo.name + "\r\n";
                    richTextBox_idCard_data.Text += "性    别:" + idInfo.sex + "\r\n";
                    richTextBox_idCard_data.Text += "换证次数:" + idInfo.certVersion + "\r\n";
                    richTextBox_idCard_data.Text += "出生日期:" + idInfo.birthday + "\r\n";
                    richTextBox_idCard_data.Text += "英文姓名:" + idInfo.ENfullname + " " +idInfo.Other + "\r\n"; //注意英文姓名,包括了备用,才是完整姓名
                    richTextBox_idCard_data.Text += "证件号码:" + idInfo.number + "\r\n";
                    richTextBox_idCard_data.Text += "有效期开始:" + idInfo.signdate + "\r\n";
                    richTextBox_idCard_data.Text += "有效期结束:" + idInfo.validterm + "\r\n";
                    richTextBox_idCard_data.Text += "国籍代码:" + idInfo.people + "/" + idInfo.Nationality + "\r\n";
                    richTextBox_idCard_data.Text += "当次申请受理机构:" + idInfo.organs + "\r\n";

                    if (idInfo.address=="") 
                    {
                        richTextBox_idCard_data.Text += "既往版本永居证号码:无" + "\r\n";
                    }
                    else { 
                        richTextBox_idCard_data.Text += "既往版本永居证号码:" + idInfo.address + "\r\n";
                    }

                    if (t_nType != 0)
                    {
                        richTextBox_idCard_data.Text += "照片数据:" + idInfo.Photo.Substring(0, 50) + "..\r\n"; //原始数据2048字符,界面只显示50字符
                    }
                }

                else  //(idInfo.certType.ToString().Trim() == "0")  //居民身份证
                {
                    richTextBox_idCard_data.Text += "读取成功,证件类型:居民身份证\r\n";
                    richTextBox_idCard_data.Text += "证件标识:" + idInfo.certType.ToString().Trim() + "\r\n";
                    richTextBox_idCard_data.Text += "姓    名:" + idInfo.name + "\r\n";
                    richTextBox_idCard_data.Text += "性    别:" + idInfo.sex + "\r\n";
                    richTextBox_idCard_data.Text += "名    族:" + idInfo.people + "\r\n";
                    richTextBox_idCard_data.Text += "出生日期:" + idInfo.birthday + "\r\n";
                    richTextBox_idCard_data.Text += "住    址:" + idInfo.address + "\r\n";
                    richTextBox_idCard_data.Text += "发证日期:" + idInfo.signdate + "\r\n";
                    richTextBox_idCard_data.Text += "有效日期:" + idInfo.validterm + "\r\n";
                    richTextBox_idCard_data.Text += "证件号码:" + idInfo.number + "\r\n";
                    richTextBox_idCard_data.Text += "发证机关:" + idInfo.organs + "\r\n";
                    richTextBox_idCard_data.Text += "其    他:" + idInfo.Other + "\r\n";
                    if (t_nType != 0)
                    {
                        richTextBox_idCard_data.Text += "照片数据:" + idInfo.Photo.Substring(0, 50) + "..\r\n"; //原始数据2048字符,界面只显示50字符
                    }
                    if (t_nType == 2)
                    {
                        richTextBox_idCard_data.Text += "指纹数据:" + idInfo.figData.Substring(0, 50) + "..\r\n"; //原始数据2048字符,界面只显示50字符
                    }
                }
    if (t_nType != 0)   //显示照片文件
    { 

        // pictureBox_idCard_photo.Image = Image.FromFile(t_szPicPath.ToString());
        // 显示照片,这个方法二次刷卡可能不显示照片,故改用下面方法来显示照片
        Image imgtmp = Image.FromFile(t_szPicPath.ToString());//这样做可以及时释放文件占用
        Bitmap img = new Bitmap(imgtmp);
        imgtmp.Dispose();
        pictureBox_idCard_photo.Image = img;
     }
}
else
{
    richTextBox_idCard_data.Text += "身份证读取失败:"+ t_arrChMsg.ToString() + ",返回值:" + t_nRe + "\r\n";
}
}

你可能感兴趣的:(c#,身份证读卡器,外国人永居证,身份证阅读器)