Hi,
You can use the folowing code to acquire multiple image from a document feeder using a separator sheets.
Notes:- This code assumes that the first page in the feeder is a separator sheet.
- This code creates multipage PDF files. You can modify it easily in order to acquire into multipage TIFF files.
- This code is working from the GdPicture [PRO] V 5.0.5
http://www.gdpicture.com/download.php- Code: Select all
Dim nPDFNo As Long
Dim nImageID As Long
Dim nTemplateSeparator As Long
Dim nCloserTemplate As Long
Dim nCpt As Long
Dim Imaging1 As Object
Set Imaging1 = CreateObject("gdpicturepro5.imaging") 'GdPicture Pro. For GdPicture Light must be "gdpicture4.imaging"
Imaging1.SetLicenseNumber ("YourLicenseKEY")
Imaging1.TwainOpenDefaultSource
Imaging1.TwainSetHideUI (True)
Imaging1.TwainSetAutoFeed (True) 'Set AutoFeed Enabled
Imaging1.TwainSetAutoScan (True) 'To achieve the maximum scanning rate
'First STEP: We create a new document identifier template from a scan of the paper separator
nImageID = Imaging1.CreateImageFromTwain(Me.hWnd)
nTemplateSeparator = Imaging1.ADRCreateTemplateFromGdPictureImage(nImageID)
Imaging1.CloseImage (nImageID)
'Step 2, Now we will scan all the document feeder into several PDF files (a new PDF is created if a paper separator is detected)
nPDFNo = 1
Imaging1.TwainPdfStart ("output" & Str(nPDFNo) & ".pdf")
While Imaging1.CreateImageFromTwain(Me.hWnd) <> 0
nCpt = nCpt + 1
nImageID = Imaging1.GetNativeImage
nCloserTemplate = Imaging1.ADRGetCloserTemplateForGdPictureImage(nImageID)
If nCloserTemplate = nTemplateSeparator And Imaging1.ADRGetLastRelevance >= 92 Then
'A paper separator seems to be detected, we start on a new output PDF
Imaging1.TwainPdfStop
nPDFNo = nPDFNo + 1
Imaging1.TwainPdfStart ("output" & Str(nPDFNo) & ".pdf")
Else
Imaging1.TwainAddGdPictureImageToPdf (nImageID)
End If
Imaging1.CloseImage (nImageID)
Wend
Imaging1.TwainPdfStop
Call Imaging1.TwainCloseSource
Let me know if you have any question regarding this method.
Best regards,
Loïc Carrère