soukoku / ntwain

A TWAIN lib for dotnet.
MIT License
119 stars 49 forks source link

Error while scanning with Canon DR M260 #8

Open ramveersgh opened 5 years ago

ramveersgh commented 5 years ago

When scanning with Canon DR M260 twain driver, I am getting the following error - Scanner error (unknown error-error code: 27).

Kindly suggest fixing this issue.

image

florianhaehnlein commented 5 years ago

Ive got the same Problem with the Canon dr g 2090. Its look like a Problem of the imagefomula driver. I found out that its a kind of sequence Error in the dsm. i have tryed some other twain frameworks and it raises the same message with saraff etc. Only the Twain for c# by TwainCoperation can succesfully work with the Scanner.

florianhaehnlein commented 5 years ago

It happens in DoTransferRoutine(ITwainSessionInternal session).

For every try to get some DGControl it returns a seqerror.

ramveersgh commented 5 years ago

@florianhaehnlein : Thank you very much for your reply.. Did you fins any solution for this in NTwain? OR You used Twain for c# by TwainCoperation ??

qlik18 commented 4 years ago

@ramveersgh, @florianhaehnlein Did you find any solution for this error? I try using Twine for Canon DR M260....

Ackara commented 4 years ago

I am unable to consistently reproduce this error. Can anyone provide the steps required to reproduce the error?

yuanshengyu commented 3 years ago

@florianhaehnlein Hi. Do you have any solution in addition to twain-cs

jerinthomasexperion commented 3 years ago

@ramveersgh @Ackara @yuanshengyu Did you find any solution for this error. We are getting this error on Canon DRG-2110. We are using NTwain from Nuget.

moonpink20 commented 3 years ago

Hi! Does someone find a solution to this error? Thanks

akselkvitberg commented 2 years ago

I got the same error with SARAFF software, but fixed it by setting IsTwain2Enable = false. So it might seem like the imageformua driver has some issues with newer twain versions. I could not find how to set the protocol version using ntwain to test, is this possible?

soukoku commented 2 years ago

There is. Set PlatformInfo.Current.PreferNewDSM = false.

icehaopan commented 1 year ago

Set PlatformInfo.Current.PreferNewDSM = false doesn't work. I try to make some modifications and it works.

step1. add a new class in ntwain.dll and add a static variable in it to recode that if you choice the Canon G2090 scanner. ScannerType.Is_Canon_G2090

step2. Modify the version of twain to 1.9. // code in yourself source // ....... code of choice a new ds ScannerType.Is_Canon_G2090 = false; if (ds.Name.Contains("G2090")) { ScannerType.Is_Canon_G2090 = true; twain.ChangeAppTwainVersionTo1Point9(); } // code in class TwainSession.cs public void ChangeAppTwainVersionTo1Point9() { this._appId.ProtocolMajor = 1; this._appId.ProtocolMinor = 9; }

step3. when open the ds, add some code in DataSource.cs, in fact I find that when you invoke the method UpdateCallBack will always return failure whatever scanner you are using. But when you are using the Canon G2090 scanner it'll pop an error messagebox [error code = 27]. rc = _session.DGControl.Identity.OpenDS(this); if (!ScannerType.Is_Canon_G2090) { _session.UpdateCallback(); }

step4. modify the method in class TransferLogic.cs if (!ScannerType.Is_Canon_G2090 && session.DGControl.XferGroup.Get(ref xferGroup) == ReturnCode.Success) { xferAudio = (xferGroup & DataGroups.Audio) == DataGroups.Audio; xferImage = xferGroup == DataGroups.None || (xferGroup & DataGroups.Image) == DataGroups.Image; }

    var rc = ReturnCode.Failure;
    if (ScannerType.Is_Canon_G2090)
    {
        rc = ReturnCode.Success;
    }
    else
    {
        rc = session.DGControl.PendingXfers.Get(pending);
    }

I can't explain this, but it really works anyway.

ljchengx commented 7 months ago

@ramveersgh @yuanshengyu @qlik18 @jerinthomasexperion Have you found a solution yet?

Neo6400 commented 1 month ago

Is there anything new here?

I am getting the same issue with Canon DR - S150, but scanning function works.

I am working with NAPS2 library.

Thank you