Loading...

read multiple pages from adf scanner

Support for GdTwain ActiveX and GdTwain Pro ActiveX/SDK.

read multiple pages from adf scanner

Postby ulli » Thu Oct 04, 2007 7:12 am

Hi,

how can I read multiple pages from scanner with ADF?
Is there a sample?

Thank you for your support.

Regards
Ulli
ulli
 
Posts: 2
Joined: Thu Oct 04, 2007 6:40 am

Postby Loïc » Thu Oct 04, 2007 10:10 am

Hi,

if you download the full package you will get many samples in several languages.

You can access too to the online GdTwain samples from this link: http://gdpicture.com/samples/gdtwain-tw ... amples.php

Best regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4441
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Postby ulli » Thu Oct 04, 2007 1:35 pm

Hi,

thank you for your support.
It works, but how can I avaoid that the twain source gets closed right away?

I am using following code (Visual FoxPro):

WITH THISFORM
IF VARTYPE(.oTwain)='O'
llStoreToFile = (.chkToJPGFile.VALUE .OR. .chkToPDFFile.VALUE)
llTwainUI = .chkSetup.VALUE

.oTwain.TwainSetHideUI(!llTwainUI)
.oTwain.TwainSetAutoFeed(.T.)
.oTwain.TwainSetAutoScan(.T.)
.oTwain.TwainSetIndicators (.F.)

lnImageCnt = 0
DO WHILE .T.
lnImageID = .oTwain.CreateImageFromTwain(APPLICATION.HWND)
IF lnImageID<>0
lnImageID = .oTwain.GetNativeImage()
lnImageCnt = lnImageCnt+1

IF lnImageCnt=1
.oTwain.TiffSaveAsNativeMultipage ('test1.tif',2)
ELSE
.oTwain.TiffAddToNativeMultipage (lnImageID)
.oTwain.CloseImage(lnImageID)
ENDIF
ELSE
EXIT
ENDIF
ENDDO

.oTwain.TiffCloseNativeMultiPage()
ENDIF

lnState = .oTwain.TwainGetState()
IF lnState<4
WAIT WINDOW 'Twain gets started...' NOWAIT
.oTwain.TwainOpenDefaultSource()
WAIT CLEAR
ENDIF

WAIT WINDOW 'SCAN finished' TIMEOUT 1
ENDWITH
ulli
 
Posts: 2
Joined: Thu Oct 04, 2007 6:40 am

Postby Loïc » Thu Oct 04, 2007 2:35 pm

It works, but how can I avaoid that the twain source gets closed right away?


Excellent question !

With the current edition, at the end of an acquisition process unsing autofeed mode, the source is always closed.

For the next edition I will add a TwainDisableAutoSourceClose() method to avoid the source closed after a scan process.
This edition will be available the next week.

Best regards,

Loïc Carrère
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4441
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

twain1.TwainDisableAutoSourceClose(True)

Postby NWM » Thu Oct 18, 2007 2:51 am

Testing your VB.net 2005 included example program, I could only get my fujitsu scanner to scan more than one sheet of paper per job if I allowed the scanner user interface to open. This only worked on the first scan job. Subsequent scan jobs only take one sheet of paper and stop.

I tried adding the following line of code to Demo3 to try and make it actually scan more than one sheet of paper.

twain1.TwainDisableAutoSourceClose(True)

Calling twain1.TwainDisableAutoSourceClose(True) in VB.Net 2005 produces the following error.

"The runtime has encountered a fatal error. The address of the error was at 0x79f36793, on thread 0x144c. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack. "

There seems to be a bug in this code. Any suggestions?
NWM
NWM
 
Posts: 11
Joined: Wed Oct 17, 2007 8:09 pm

Postby Loïc » Thu Oct 18, 2007 10:48 am

You are right, it was a bug into the gdtwain.dll library.

A fix has done.

Please update your component from here: http://www.gdpicture.com/download.php


Regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4441
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

AutoFeed Failure

Postby NWM » Thu Oct 18, 2007 7:49 pm

That fixed that command.

Thank you! This OCX looks very promising for my needs. Thank you for your quick response!!

AutoFeed of multipage documents still fails. It works the first time but not thereafter. Before the first scan twain1.TwainIsAutoFeedOn() returns true, but thereafter false.

Attempting to turn on autofeed using twain1.TwainSetAutoFeed(True) returns true but testing twain1.TwainIsAutoFeedOn() returns false immediately after.

twain1.TwainSetAutoScan(True) does not work.

Is there a way to fix this??

Thank you again!
NWM
NWM
 
Posts: 11
Joined: Wed Oct 17, 2007 8:09 pm

Postby Loïc » Sat Nov 03, 2007 7:03 pm

Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4441
Joined: Tue Oct 17, 2006 10:48 pm
Location: France


Return to GdTwain [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest