示例#1
0
        public bool SetPaperSource()
        {
            bool flag = false;

            if (twSession.defaultScannerName.ToLower().Contains("kodak"))
            {
                capId = TwCap.CAP_PAPERSOURCE;
                TwType  type   = capType;
                CapInfo tmpCap = new CapInfo();
                tmpCap.capId         = capId;
                tmpCap.capType       = capType;
                tmpCap.currentIntStr = currentIntStr;
                flag  = twSession.SetCapability(tmpCap);
                capId = TwCap.ECAP_PAPERSOURCE;
            }
            return(flag);
        }
示例#2
0
        public List <string> GetDataList()
        {
            if (capId == TwCap.ICAP_IMAGEFILEFORMAT)
            {
                CapInfo xferCapInfo = twSession.GetScannerCap(TwCap.ICAP_XferMech);
                if (xferCapInfo.currentIntStr == "0") // native模式下的文件格式
                {
                    List <string> tmpCapValueList = new List <string>();
                    tmpCapValueList.Add("0"); // TWFF_TIFF
                    tmpCapValueList.Add("2"); // TWFF_BMP
                    tmpCapValueList.Add("4"); // TWFF_JFIF
                    tmpCapValueList.Add("7"); // TWFF_PNG
                    return(tmpCapValueList);
                }
            }
            if (capId == TwCap.ICAP_COMPRESSION)
            {
                CapInfo xferCapInfo = twSession.GetScannerCap(TwCap.ICAP_XferMech);
                if (xferCapInfo.currentIntStr == "0") // native模式下的压缩格式
                {
                    List <string> tmpCapValueList = new List <string>();
                    tmpCapValueList.Add("0");              // TWCP_NONE
                    CapInfo pixelCapInfo = twSession.GetScannerCap(TwCap.ICAP_PixelType);
                    if (pixelCapInfo.CurrentIntStr == "0") //BW
                    {
                        tmpCapValueList.Add("5");          // TWCP_GROUP4
                    }
                    return(tmpCapValueList);
                }
            }

            if (valueList == null)
            {
                return(null);
            }
            List <string> capValueList = new List <string>();

            foreach (object item in valueList)
            {
                string capValueStr = item.ToString();
                capValueList.Add(capValueStr);
            }
            //if (capId == TwCap.ICAP_IMAGEFILEFORMAT) // File
            //{
            //    //
            //}
            if (capId == TwCap.ICAP_COMPRESSION) // File
            {
                CapInfo formatCapInfoF = twSession.GetScannerCap(TwCap.ICAP_IMAGEFILEFORMAT);
                if (formatCapInfoF.CurrentIntStr == "4") // 去掉JPG以外的压缩方式
                {
                    // 去掉JPG以外的文件格式
                    List <string> delList = new List <string>();
                    foreach (string value in capValueList)
                    {
                        if (value != "6")
                        {
                            delList.Add(value);
                        }
                    }
                    foreach (string value in delList)
                    {
                        capValueList.Remove(value);
                    }
                }
            }
            return(capValueList);
        }