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,