WUE 2.0 Duplex

I am developing a C # application to use the WIA 2.0 library. At the moment, I can use most functions, such as ADF (automatic document feeder), filters, etc.

Now I need to use the duplexer of my scanner (fujitsu).

I am trying to set the scanner's WIA_DPS_DOCUMENT_HANDLING_SELECT property to DUPLEX. See code below:

  try
        {
            bool hasMorePages = false;
            //determine if there are any more pages waiting
            Property documentHandlingSelect = null;
            Property documentHandlingStatus = null;
            foreach (Property prop in WiaDev.Properties)
            {
                if (prop.PropertyID == WIA_PROPERTIES.WIA_DPS_DOCUMENT_HANDLING_SELECT)
                    documentHandlingSelect = prop;
                if (prop.PropertyID == WIA_PROPERTIES.WIA_DPS_DOCUMENT_HANDLING_STATUS)
                    documentHandlingStatus = prop;
            }

            object obj = new object();
            obj = (WIA_DPS_DOCUMENT_HANDLING_SELECT.DUPLEX);
            documentHandlingSelect.set_Value(ref obj);

            if (documentHandlingSelect != null) //may not exist on flatbed scanner but required for feeder
            {
                //check for document feeder
                if ((Convert.ToUInt32(documentHandlingSelect.get_Value()) & WIA_DPS_DOCUMENT_HANDLING_SELECT.FEEDER) != 0)
                {
                    hasMorePages = ((Convert.ToUInt32(documentHandlingStatus.get_Value()) & WIA_DPS_DOCUMENT_HANDLING_STATUS.FEED_READY) != 0);
                    if (hasMorePages)
                    {
                        // set the property to use FEEDER and DUPLEX (this result in the value of 5 in the property)
                        object obj = new object();
                        obj = (WIA_DPS_DOCUMENT_HANDLING_SELECT.FEEDER | WIA_DPS_DOCUMENT_HANDLING_SELECT.DUPLEX);
                        documentHandlingSelect.set_Value(ref obj);
                    }
                }
            }
            return hasMorePages;

This code compiles fine, but I cannot get two images while executing this line. It only extracts the front:

imgFile = (ImageFile)wiaCommonDialog.ShowTransfer(item, format.Guid.ToString("B")/* wiaFormatJPEG*/, false);

I read in many topics, as well as in the documentation, that you can get Children objects from an element on a scanner, but there is only one element in this collection.

Please help me!

thank

+3
1

, , , . , .

.

imgFile = (ImageFile)wiaCommonDialog.ShowTransfer(item, format.Guid.ToString("B")/* wiaFormatJPEG*/, false);
imgFile2 = (ImageFile)wiaCommonDialog.ShowTransfer(item, format.Guid.ToString("B")/* wiaFormatJPEG*/, false);

. , .

+3

Source: https://habr.com/ru/post/1771675/


All Articles