Home › Forums › TWAIN Classic › Scanning images using JTwain API
- This topic has 1 reply, 2 voices, and was last updated 15 years, 2 months ago by fct.
- AuthorPosts
I am using JTwain API for implementing Scanning functionality in our project.I need to know how would I add a capability of selective scanning of pages.For our Scan Documents business case,the user can specify on the applet screen what particular page nos have to be scanned.
If page numbers or ranges are specified for scanning, then the scanning will be performed as follows:“2,4,7” – scan the specified pages
“3-5” – scan the range
“5-“ – scan from page 5 to end
“b-4-” scan last 4 pages
Apart from this,I have another thing to ask. I am using acquire() function in the jtwain cpp file for acquiring multiple(all pages which have been placed on ADF) images.when i compile that file to generate a DLL file, I get the following two errors:Error E2356 jtwain.cpp 332: Type mismatch in redeclaration of ‘__stdcall Java_ne
t_javajeff_jtwain_JTwain_ (JNIEnv_ *,_jclass *)’Error E2344 jtwain.h 23: Earlier declaration of ‘__stdcall Java_net_javajeff_jtw
ain_JTwain_acquire(JNIEnv_ *,_jclass *)’.Thanks!
@Priyanka Singhal wrote:
I am using JTwain API for implementing Scanning functionality in our project.I need to know how would I add a capability of selective scanning of pages.For our Scan Documents business case,the user can specify on the applet screen what particular page nos have to be scanned.
If page numbers or ranges are specified for scanning, then the scanning will be performed as follows:“2,4,7” – scan the specified pages
“3-5” – scan the range
“5-“ – scan from page 5 to end
“b-4-” scan last 4 pagesSince you’re using a scanner with a feeder (or so I understand from your message) what’s going to happen is that it will actually feed all the pages in the feeder before you can select the ones you want and discard the others (specially if you don’t know the number of pages beforehand in the b-4- case).
So you could:
1) just scan every page to files in disk sorted by number of page (scan001.jpg, scan002.jpg, etc.) and then delete those not selected.
2) keep a counter and increase it after every successful scan of a single page, so you can discard pages on the fly if they don’t belong to the selection. This implementation will be more complicated in the b-4- case when you don’t know how many pages are to be scanned.
3) There are also the capabilities CAP_CLEARPAGE, CAP_FEEDPAGE, CAP_AUTOFEED, etc. which you can use to eject pages instead of actually scanning them. The b-4- case doesn’t apply here, again.
@Priyanka Singhal wrote:
Apart from this,I have another thing to ask. I am using acquire() function in the jtwain cpp file for acquiring multiple(all pages which have been placed on ADF) images.when i compile that file to generate a DLL file, I get the following two errors:
Error E2356 jtwain.cpp 332: Type mismatch in redeclaration of ‘__stdcall Java_ne
t_javajeff_jtwain_JTwain_ (JNIEnv_ *,_jclass *)’Error E2344 jtwain.h 23: Earlier declaration of ‘__stdcall Java_net_javajeff_jtw
ain_JTwain_acquire(JNIEnv_ *,_jclass *)’.Check the project settings in Visual Studio (if that’s what you’re using). I think you must set the C/C++ Code Generation to Multi-Threaded DLL.
If your project settings are correct, check for code mistakes like recursive includes, but if you can’t find such mistakes it might be some compilation or linking setting.
- AuthorPosts