Scanner initialization

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
rcsingle
Posts: 10
Joined: Tue Jan 12, 2010 11:37 pm

Scanner initialization

Post by rcsingle » Tue Feb 09, 2010 6:47 pm

Is there a way to get the scanner to automatically be ready to scan from the ADF when using Twain scanning? Currently every time I run the scanning process the scanner seems to re-initialize and do a bunch of repositioning of the scanning lens before it decides to actually grab a page from the ADF and scan it. It seems like it is looking to see if there is a page on the flatbed before using the ADF.

Thanks,
Randy

User avatar
Loïc
Site Admin
Posts: 5698
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Scanner initialization

Post by Loïc » Tue Feb 09, 2010 7:01 pm

Hi,

Maybe calling TwainSelectFeeder(True) can help ?

What is the code you are using to scan?

Kind regards,

Loïc

rcsingle
Posts: 10
Joined: Tue Jan 12, 2010 11:37 pm

Re: Scanner initialization

Post by rcsingle » Tue Feb 09, 2010 10:39 pm

Here is the code (from GdPicture sample code) with "TwainSelectFeeder(True)" added. It didn't help.

Code: Select all

   Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
        'Here we will scan in a 24bpp  & 300 DPI from ADF into separate jpeg files
        Dim nImageCount As Integer
        Dim ImageID As Integer


        If oGdPictureImaging.TwainOpenDefaultSource(Me.Handle) Then
            nImageCount = 0

            InitScanConfig()

            oGdPictureImaging.TwainSetAutoFeed(True) 'Set AutoFeed Enabled
            oGdPictureImaging.TwainSetAutoScan(True) 'To  achieve the maximum scanning rate
            oGdPictureImaging.TwainSetResolution(300)
            oGdPictureImaging.TwainSetPixelType(TwainPixelType.TWPT_RGB) 'RGB
            oGdPictureImaging.TwainSetBitDepth(8) ' 24 bpp
            oGdPictureImaging.TwainSelectFeeder(True)

            Do
                ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
                If ImageID <> 0 Then
                    Call ApplyImageFilters(ImageID)
                    If chkPreview.CheckState = 1 Then Call DisplayImage(ImageID)
                    nImageCount = nImageCount + 1
                    Call oGdPictureImaging.SaveAsJPEG(ImageID, My.Application.Info.DirectoryPath & "\image" & Trim(Str(nImageCount)) & ".jpg", 75)
                    Call oGdPictureImaging.ReleaseGdPictureImage(ImageID)
                End If
            Loop While oGdPictureImaging.TwainGetState > TwainStatus.TWAIN_SOURCE_ENABLED

            Call oGdPictureImaging.TwainCloseSource()
            MsgBox("Done !")
        Else
            MsgBox("can't open default source, twain state is: " & oGdPictureImaging.TwainGetState.ToString)
        End If

    End Sub

Thanks,
Randy

User avatar
Loïc
Site Admin
Posts: 5698
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Scanner initialization

Post by Loïc » Thu Feb 11, 2010 5:01 pm

Hi Randy,

unfortunately I can't do nothing more.

This behavior is probably caused by your TWAIN driver.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest