The application is installed on the server and all users run the application through shortcut , so the problem is when the users scan multiple documents they will save it to the same temporary file, plz help
this snippet code to scan multiple documents and save it to a temp file (TIFF)
Code: Select all
Dim nImageCount As Integer
Dim nImageID As Long
CloseImage
If Imaging1.TwainGetState < 4 Then Imaging1.TwainOpenDefaultSource
If Imaging1.TwainOpenDefaultSource() Then
nImageCount = 0
Imaging1.TwainSetAutoFeed (True) 'Set AutoFeed Enabled
Imaging1.TwainSetAutoScan (True) 'To achieve the maximum scanning rate
Imaging1.TwainSetCurrentResolution (200)
Imaging1.TwainSetCurrentPixelType (TWPT_BW) 'BW black and white
Imaging1.TwainSetCurrentBitDepth (1) ' 1 bpp
Do
nImageID = Imaging1.TwainAcquireToGdPictureImage(Me.hwnd)
nImageCount = nImageCount + 1
DisplayNativeImage
If nImageCount = 1 Then
Call Imaging1.TiffSaveAsNativeMultiPage(App.path & "\output.tif", CompressionCCITT4)
Else
Imaging1.TiffAddToNativeMultiPage (nImageID)
Imaging1.CloseImage (nImageID)
End If
Loop While Imaging1.TwainGetState > TWAIN_SOURCE_OPEN
Imaging1.TiffCloseNativeMultiPage
Imaging1.TwainCloseSource
Call Imaging1.TiffCreateMultiPageFromFile(App.path & "\output.tif")
If Imaging1.GetStat = 0 Then
Call ShowBitmap
Call ShowBitmapProperties
Call EnableDisableControls
End If
MsgBox "Done !"
Else
MsgBox "can't open default source, twain state is: " & Trim(Str(Imaging1.TwainGetState))
End If