Problems with add image with version 6.4.4

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
anvasi
Posts: 33
Joined: Fri Dec 12, 2008 1:16 pm

Problems with add image with version 6.4.4

Post by anvasi » Fri Sep 18, 2009 2:48 pm

Hi loic,

i have a problem with the version 6.4.4 when i want to add image with TWAIN Acquisition.

With then version 6.2.0.15 this code works fine and if we work with the 6.4.4 the first scan it's ok but if we select yes on "Quieres añadir más páginas ? ", then imageid = 0 .

Code: Select all

     
                If gdimaging1.TwainOpenDefaultSource(Me.Handle) Then
                If gdimaging1.TwainGetAvailablePixelTypeCount = 0 Then
                    MsgBox("El escaner tiene un error.Por favor compruebalo", MsgBoxStyle.Critical)
                End If

                If File.Exists(Mid(fichero_original, 1, Len(Trim(fichero_original)) - 4) & ".xml") Then
                    File.Delete(Mid(fichero_original, 1, Len(Trim(fichero_original)) - 4) & ".xml")
                End If
                nimagecount = 0

                InitScanConfig()
                gdimaging1.TwainSetResolution(resolucion.Text)
                gdimaging1.TwainSetPaperSize(tipo_papel.SelectedItem)
                gdimaging1.TwainSetPixelType(tipo_color.SelectedItem)
                Select Case gdimaging1.TwainGetPixelType

                    Case GdPicture.TwainPixelType.TWPT_BW ' GdPicturePro5.TwainPixelType.TWPT_BW
                        gdimaging1.TwainSetBitDepth(1)

                    Case GdPicture.TwainPixelType.TWPT_GRAY
                        gdimaging1.TwainSetBitDepth(8)

                    Case Else
                        gdimaging1.TwainSetBitDepth(24)

                End Select
                gdimaging1.TwainSetAutoFeed(True) 'Set AutoFeed Enabled
                gdimaging1.TwainSetAutoScan(True) 'To  achieve the maximum scanning rate
color_selec:
                Dim ff As Long
                ff = gdimaging1.TwainGetState()
                If ff = 4 Then
                    If gdimaging1.TwainIsAutoFeedAvailable() = True Then
                        autofeed = False
                    Else
                        autofeed = True
                    End If
                End If
                gdimaging1.TwainSetAutoFeed(True) 'Set AutoFeed Enabled
                gdimaging1.TwainSetAutoScan(True) 'To  achieve the maximum scanning rate

               ************************************************************************************************
                                                here is the code on are the problem
            

                Do
                imageid = gdimaging1.TwainAcquireToGdPictureImage(Me.Handle)
                    If imageid <> 0 Then
                        nimagecount = nimagecount + 1
                        TLabel2.Text = "Páginas :  " & nimagecount
                        Call ApplyImageFilters(imageid)
                        Call DisplayImage(imageid)
                        If nimagecount = 1 Then
                            multipageid = imageid
                            Call gdimaging1.TiffSaveAsMultiPageFile(multipageid, fichero_original, TiffCompression.TiffCompressionCCITT4)
                        Else
                            gdimaging1.TiffAddToMultiPageFile(multipageid, imageid)
                            gdimaging1.ReleaseGdPictureImage(imageid)
                        End If
                    End If
                    If gdimaging1.TwainGetState <= TwainStatus.TWAIN_SOURCE_ENABLED Then
                        If MsgBox("Quieres añadir más páginas ?", MsgBoxStyle.YesNo) = 6 Then
                            bcontinue = True

                        Else
                            bcontinue = False
                        End If
                    Else
                        bcontinue = True
                    End If
                Loop While bcontinue
                ************************************************************************************************



Thanks a lot,

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

Re: Problems with add image with version 6.4.4

Post by Loïc » Fri Sep 18, 2009 2:55 pm

Hi,

You should add this line at the start of your code:

Code: Select all

gdimaging1.TwainSetAutoSourceClose(False)
This should solve your issue.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests