Forum Replies Created
- AuthorPosts
the scanner warms up every time I click the Scan button
This just sounds like a driver bug, and getting Plustek to fix it might be the easiest solution. Or they might find a work-around.
What application are you using? I’m not sure if the continuous scan mode is all inside the Plustek scanner driver, but it sounds like it. I would guess that in that mode, the application thinks the Plustek has a document feeder, so it does a ‘batch’ scan. With TWAIN scanners, a batch scan isn’t allowed to change parameters between pages, so going in that direction would be a dead end. But this is all speculation, again the people to talk to will be Plustek.
Not a simple thing, because this isn’t something contemplated in the TWAIN standard. In the standard, the application tells the driver whether to show its dialog or not.
If you want to do this without support from the application, then you’re working outside the TWAIN standard and it’s going to be pure luck to find a driver that supports this. I’m personally kind of amazed that you found this for the Panasonic, but maybe it is more common than I expect.If the Fujitsu doesn’t offer this somewhere visible, and Fujitsu technical support doesn’t offer any help, you are probably stuck.
It would be technically possible to create a piece of software that would intercept the TWAIN communication and fool the driver that the application is asking for “no UI” scanning.
I don’t think this would work well in practice, because when an application turns off the scanner’s UI, it typically also does a bunch of other things – which your applications would not be doing.
Also a typical driver won’t scan with exactly the last settings when you turn off its UI, because TWAIN doesn’t require or even recommend that.
So this would be a large, complicated, messy project.Hmm… the other possible ‘hack’ would be an application that runs in the background, watches for the scanner’s TWAIN dialog to be created, and generates a button-click on the Scan button. That would be do-able, you might even find a Windows ‘automation’ program that would make it fairly easy.
Allthough… I’m not finding anything right away…Hi Pamxy – unless you have an application that you KNOW needs this feature, there is no reason to worry about ICAP_IMAGEMERGE.
I have never used it in an application, implemented it in a DS, or seen a DS that supported it, or heard of it being used.I urge you to make all the basic features of your DS work correctly first. Someday (in 5 years) when somebody asks for this feature, then write this code.
8)Hi pamxy
I would add this:
Have your own integer variable imageCount: how many more images application wants.
When you start scan, set imageCount = value of CAP_XFERCOUNT. This will be -1 which means ‘as many as possible’, or N > 0 which means ‘application only want N images’.When you complete an image transfer, if imageCount > 0, do –imageCount.
Before other tests in the endXfer function, check if imageCount == 0.
If imageCount ==0, then set State = 5, set m_Xfers.Count = 0, turn off motor 😉 and return.Automatic Scan. in endXfer function, add judgment sentences to judge if there’s paper (in ADF). If yes, then call scan function. That’s what I think of the Automatic Scanning feature.
Sounds OK to me. Comes after duplex check. Set m_Xfers.Count = -1, set State = 6, return.
Duplex Scan. add judgment sentences in endXfer function as well, but judge if ICAP_DUPLEXENABLE is TRUE and the image of front side has been sent. If yes, then m_Xfers.Count = 1 and the current status is changed to dsState_XferReady. That’s how the duplex scanning is implemented.
I would say, m_Xfers.Count = -1, which means “some more images, I don’t know how many”.
Unless you can count the pages in the ADF, it is normal to use -1 for this.What’s the distortion look like?
Are you taking account of the fact that in a bitmap (DIB) the size of each row is a multiple of 4 bytes?
I see you using that to calculate the size of the DIB, but I don’t see you padding each row up to a multiple of 4 bytes when you copy data from the buffer during memory transfer.
Also, Windows has no concept of grayscale DIB – grayscale images are managed as 256-color DIBs. So there has to be a 256-entry color table after the header, and I don’t see that either.
I just skimmed the code, I’m sorry if I missed something!You could scan each image into a bmp file (1.bmp, 2.bmp, …), then use Imagemagick to combine all the bmp’s into a PDF.
http://www.imagemagick.org/script/index.phpImagemagick can do a bazillion things, is free, and is a command-line app so VB can run it as a sub-process.
e.g. http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=21289
Google is your friend here.Take a look at DG_CONTROL / DAT_IDENTITY / MSG_SET.
In the TWAIN Specification version 2.2, it is at section 7 page 69.Problem: This feature was only introduced in TWAIN 2.2, so you would have to make sure the TWAIN Manager you are talking to understands TWAIN 2.2 or later.
I am not sure that any of the TWAIN managers (twain_32.dll) distributed with Windows support this feature… maybe somebody else can chime in here?
You may have to use the newer TWAINDSM.DLL, so you would have to either work with the user to make sure a new enough version is installed, or you could include recent version of TWAINDSM.DLL as part of your install. (Being careful to put it in the right folder, not overwrite a newer version, etc.)This really isn’t a recommended thing to do, because it sets the default TWAIN device for *all* TWAIN applications for the current user.
More customary is for the application to- enumerate the available scanners (with DAT_IDENTITY/MSG_GETFIRST,MSG_GETNEXT)
- let the user select the application’s current scanner from that list (using a drop-list or listbox)
- save that selection e.g. in the registry
- when asked to scan, use that (application-specific) scanner choice
Hi subhajit – is the TWAIN device in the Open state when you start that code?
and after that code, you start a scan by doing something like Enable or EnableSource?
(I don’t know this particular library you are using).Both your DSilayout calls return TWRC_SUCCESS?
Are you setting any other scanning parameters?
I hope if you are setting ICAP_UNITS at all, it is to TWUN_INCHES 😉You could download and try something like my Twirl app, to see how your Canon responds to ImageLayout.
http://eztwain.com/twirl.htm
At least then you could have the confidence that the commands *should* work, and you can concentrate on digging into the code to see where things go awry.June 11, 2013 at 7:49 pm in reply to: TWAIN Scanning 2008 R2 Server/Desktop Experience INSTALLED #25910Hi Phil – if Twack 32 sees the scanner (and can scan from it) then you’ve got working (32-bit) drivers, that’s good. Especially on Windows Server 2008 R2!
What version of Word are you testing with, and what are the other programs that utilize TWAIN?
Generally, if an application supports TWAIN and you have working TWAIN drivers, the application will show those drivers.
If it doesn’t, usually one of these things is happening:
1. The application is a 64-bit application. It will *not* be able to use the 32-bit TWAIN drivers seen by Twack_32. It will be able to use 64-bit TWAIN drivers as shown by Twack_64, but… 64-bit TWAIN drivers are not yet commonly available.
2. The application does not support TWAIN – check the specifications or support area of the application to confirm that it supports TWAIN.A few applications support WIA instead of TWAIN. Those applications will ‘see’ some scanners that are WIA-compatible, and not see others. You can see your WIA-compatible scanners in the Device Manager, under ‘Imaging devices’.
Start by changing
ui.ShowUI = TRUE;
to
ui.ShowUI = FALSE;
That tells the scanner driver to enable itself for scanning without its UI.
Normally, this causes the scanner to immediately start scanning with the current settings…
Note that the ‘current settings’ will be an unpredictable mixture of TWAIN defaults and whatever your scanner feels like.
You should plan on setting ICAP_PIXELTYPE and ICAP_XRESOLUTION at a minimum, unless you really don’t care about even those settings.Other suggestion: disable the scanner when you are done with the scan job, and close the scanner when you are ‘done scanning’.
Many applications close the scanner after every scan job, but closing & opening the scanner does take a few seconds with most scanners.Exactly. 8)
Well, glad you are running a good antivirus, and that the problem is gone.
If you meant to type that, Twunk.32.exe (with two periods) then I’d say definitely it was a virus – I don’t think there is any legitimate file with that name.
If that was a typo and your file was really named twunk_32.exe, then that is the name of a legitimate file distributed as part of TWAIN… but that file is sometimes hijacked or replaced by various malware: That is, same name, different, bad code inside. The legitimate TWAIN file should never run more than one copy, or use up significant memory or CPU, or be running at all unless you are doing TWAIN scanning.
Good luck, happy and safe computing 8)
As Kaij suggests, color data in TWAIN can be formatted in different ways.
On Windows only:In Native transfer mode, the DS sends the image in DIB format, so pixels are BGR in memory (and rows are aligned on DWORD boundaries, etc.) If you transfer indexed-color data – TWPT_PALETTE – the color values are in the color table of the DIB, so they are stored as RGBQUAD’s. Read all about it here:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd183376(v=vs.85).aspx
(I have never seen a DS send 16-bit or 32-bit data in Native format, or use any compression except BI_RGB == 0)In Memory transfer mode, I believe color data is RGB, assuming it is uncompressed.
In File transfer mode, the format follows the standard format for the type of file.
Hi Keith –
What’s the name of the .exe, and what folder is it in? (Task Manager can tell you this)
What exactly is the symptom or symptoms?What operating system are you running?
Have you changed anything on this computer recently: New hardware, new software installed, new drivers, some kind of clean-up?
I’ve never heard of this problem (in 15 or so years of working with TWAIN) but I see it reported on the web, so I believe you 8)
But I can’t think of any reason for this program to be using CPU cycles or using up significant memory. Especially if you are not using a scanner.
So my first thought is, maybe this is a viral infection. Are you running a good anti-virus, and have you scanned that particular .exe?-spike _/_
April 19, 2013 at 2:32 pm in reply to: Twain error 42: Actual page count != Expected page count #25869Hi Jeet – thanks for the log. I don’t see anything going obviously wrong in there!
But I also have an idea for something to try:
You don’t need to end & restart the PDF file inside your loop: Move the BeginMultipageFile and EndMultipageFile calls outside your while (continueScanning) loop.
You’ll get a smaller and ‘internally cleaner’ PDF, and I bet it will eliminate this error, even though I still don’t know exactly what is causing the error.One problem is that in case of an error, you could end up with a 0-page PDF. If you care about that, you could just delete the PDF when done. (After calling EndMultipageFile first! ALWAYS call EndMultipageFile, to match any successful call to BeginMultipageFile.)
- AuthorPosts