Question

Ive been using the Morena library to scan in documents through a scanned with an ADF using Morenas TWAIN implementation. However I have found a problem when the scanner jams my program will crash and burn. Ive tried searching for some way to handle this but I just cant see to think of a practical method. If anyone could suggest a way to handle this it would be greatly appreciated.

Was it helpful?

Solution

The Twain driver should report a paper jam to the condition code status. In case of a paper jam, it should return TWCC_PAPERJAM=20. Many drivers do not support this feature. You can experiment with the getConditionCode, getResultCode methods on your specific hardware.

ImageConsumer constants are useful in detecting that a problem of some sort has occurred. (You will not be able to detect that it is a paper jam in particular that has occurred, however.) There are three possible status values:

IMAGEABORTED = The image creation process was deliberately aborted.

IMAGEERROR = An error was encountered while producing the image.

STATICIMAGEDONE = The image is complete and there are no more pixels or frames to be delivered. You can also receive these values using the getStatus method of the MorenaImage class.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top