Forums › TWAIN Classic › New to scanner world, need help on TWAIN scanner standard. › Reply To: New to scanner world, need help on TWAIN scanner standard.
- Topics - 9
- Replies - 583
- Total Posts - 592
Where to start…, um maybe with my twain background so this will be taken in the right context. I’m a nobody. I started a project that sounded like yours maybe 2 months ago. Yeah I’ve read the spec a couple dozen times, and been through this forum’s archive for a few things, but that’s it. With that out of the way,
>with any twain device,
This part hurts. This part hurts a lot, but I’ll be finishing with this part not starting.
>with any ISIS device,
I honestly have no idea of where to even start with ISIS. Lemme know if you find any .net resources in that direction, I haven’t looked into anything other than twain and wia2.
>then I need to scan the Images based on the setting of Scanner.
I like the sound of this part, especially the part where you say ‘based on the setting of the scanner’, that makes me maybe think that whatever the settings for the device happen to be at the time, that they are acceptable, or maybe that the default settings for any particular device will do, that I think (if it were me tasked with this assignment) is possible.
But somehow I don’t think that’s how it’s really meant. I get the feeling that you are tasked with an ‘everything for everyone’ twain project.
If my feeling here is even close to right and that part actually means that you’ll maybe have to adjust the current settings for any device (that last ‘any’ is important and I’ll be coming back to it) then this project is going to either go over 3 months or cut a feature, or two, or all but one or two. (Again, this is just Gabe talking – take no offence)
>some times without opening the scanner interface.
This I like, but only a little bit. Some devices won’t let you do this via twain. Reference the twain spec, and pay attention to the part where it says ‘Set the ShowUI field of the TW_USERINTERFACE structure to FALSE.’ In particular if you look thru for all the parts of the spec that mention ShowUI, you’ll get a pretty decent idea of what’s possible here, what’s not, and when.
>OS used are windows 2000/Xp/2003
I like this part too, it gives me the feeling that WIA2 may be able to do some of the heavy lifting that this project may take – well at least for the xp/2003 part. I don’t think 2000 supports WIA2. Check that part, it might.
>they are also targeting this application for 64bit platform too.
This part makes me a little uncomfortable; I don’t think the 64bit bits of twain are final yet – at least not with good driver support. Maybe someone else here on the board can share their experiences with 64bit windows twain support.
>This application can be run through web too. Hence need to support scanning through web also.
Yeah, that just makes uncomfortable. I’m pretty sure it can be done, but I’m not that guy – sorry. But it is another reason to start looking further into WIA2, as WIA2 is specifically targeted to web development.
>My project time line is 3 months.
man I hope you’re a better developer than I am, (no that’s not true – honestly I’m fairly competitive, I only say that in the hope that you’ll pull this off, and immediately thereafter post the code for everyone to learn from and use in their projects as well) Meaning that I lack the confidence to state that I could reach all those goals by myself in that time period.
>I don’t have any knowledge about WIA2.
Start looking into the samples, the msdn library that is attached to vs2005 has a real nice set of samples and articles dealing with WIA2 – Windows Image Automation 2. Be warned that wia2 looks to be supported only in the XP sp2 and up OSs, and is not completely supported by every scanner out there – maybe most of the new ones but not all.
Checkout what the people that wrote ‘Paint.net’ have done with WIA, its nothing short of amazing. Paint.net is available with full source code (bout 100,000 lines of pretty solid code), google for it.
OK, with that out of the way. My feeling is that the hardest part of getting this project delivered 100% as stated starts with the ‘any’ part. The more twain devices I see the more I think that calling twain a protocol is maybe a stretch. I’d call it more of a guideline, or maybe a set of best practices.
The kicker is that even when a manufacturer does follow the spec, the spec leaves a lot of room for custom capabilities. For example, HP or Canon may decide that they can provide a better image by added a few more capabilities (and they almost always do), but where exactly are those documented? Call the vendor, then what do you do if two vendors use the same number for different capabilities, or even if they use the same capability Id, if they define is differently, so one takes an array and the other takes an enumeration? Write seperate libraries for seperate vendors? Ok even if you’re willing to do that, what happens with the vendor changes the capabiliy from one driver to another. You can’t really call foul becasue after all, this is a custom capability in the first place. Or you could choose to just ignore all the custom capabilities, but I bet that eventually someone is going to ask for feature x, that works with the vendors software but not yours. Lately when I think of the twian spec, for some reason, the League of Nations comes to mind. (maybe I should sleep more)
If you could narrow you project down a bit, if you could for instance choose to support only one vendor’s hardware, or if you could choose to support only the capabilities listed in the spec and no custom capacities, they project would start to look more do-able (again this is just me talking)
Finishing with more positive stuff. Resources. If you haven’t already started looking at the c# twain article on code project, go their.
If you have the luxury of seriously considering one of the twain libraries already on the self, start looking at what’s out there. … I already mentioned looking into WIA2, what else…
Feel free to contact me on or off the board, I just sit round working on my twain library anyway so I have code right in front of me. You’re more than welcome to the code that I have (just drop me an email), eventually I’ll feel that it warrants a gotdotnet or sourceforge site and I’ll post it. Its vb.net 2005 code and should come out of sharpDevelop’s beta 2 in decent enough shape for you to figure out the minor conversion problems, and its got more than a bit of comments (but doesn’t everyone think this about their own code – at least while its fresh in memory?)