Scan multiple documents at once using separator sheets
Scan multiple documents at once using separator sheets
Hi,
I need scan multiple documents at once, I put a separator sheet with a known barcode between each documents .
I found this sample:
https://gdpicture.com/forum/viewtopic.p ... t=480.html
So I need help to re-write this code for my version, because I have some problems to find the corresponding methods in my version (8.3.0.5).
Anyone can help me?
thanks!
Best regards,
Ilaria
I need scan multiple documents at once, I put a separator sheet with a known barcode between each documents .
I found this sample:
https://gdpicture.com/forum/viewtopic.p ... t=480.html
So I need help to re-write this code for my version, because I have some problems to find the corresponding methods in my version (8.3.0.5).
Anyone can help me?
thanks!
Best regards,
Ilaria
Re: Scan multiple documents at once using separator sheets
Here a proposal, let me know if you need clarifications.
- 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 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.
Code: Select all
Dim ImageID As Integer
Dim TemplateSeparatorID As Integer
Dim oGdPictureImaging As New GdPictureImaging
Dim oGdPicturePDF As New GdPicturePDF
Const MIN_CONFIDENCE As Integer = 92
Dim pdfCount As Integer = 0
oGdPictureImaging.TwainOpenDefaultSource(Me.Handle)
oGdPictureImaging.TwainSetHideUI(True)
oGdPictureImaging.TwainSetAutoFeed(True) 'Set AutoFeed Enabled
oGdPictureImaging.TwainSetAutoScan(True) 'To achieve the maximum scanning rate
'First STEP: We create a new document identifier template from a scan of the paper separator
ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
TemplateSeparatorID = oGdPictureImaging.ADRCreateTemplateFromGdPictureImage(ImageID)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
'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)
oGdPicturePDF.NewPDF()
Do
ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
If ImageID <> 0 Then
Dim CloserTemplateID As Integer = oGdPictureImaging.ADRGetCloserTemplateForGdPictureImage(ImageID)
If CloserTemplateID = TemplateSeparatorID AndAlso oGdPictureImaging.ADRGetLastConfidence >= MIN_CONFIDENCE Then
'A paper separator has been detected, we start saves & start a PDF
If oGdPicturePDF.GetPageCount > 0 Then
pdfCount += 1
oGdPicturePDF.SaveToFile("output" + pdfCount.ToString() + ".pdf")
oGdPicturePDF.CloseDocument()
oGdPicturePDF.NewPDF()
End If
Else
oGdPicturePDF.AddImageFromGdPictureImage(ImageID, False, True)
End If
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
End If
Loop While oGdPictureImaging.TwainGetState > TwainStatus.TWAIN_SOURCE_ENABLED
If oGdPicturePDF.GetPageCount > 0 Then 'Saves the latest PDF, if any
pdfCount += 1
oGdPicturePDF.SaveToFile("output" + pdfCount.ToString() + ".pdf")
oGdPicturePDF.CloseDocument()
End If
Call oGdPictureImaging.TwainCloseSource()
Re: Scan multiple documents at once using separator sheets
Thanks!
It works!
Ilaria
It works!
Ilaria
Re: Scan multiple documents at once using separator sheets
I tried the solution. It never worked. The first page is the separator sheet, but the program doesn't recognize it every time.
Do I need to use separator sheet that can be understood by a scanner? or any page that can act as separator sheet?
Do I need to use separator sheet that can be understood by a scanner? or any page that can act as separator sheet?
-
- Posts: 352
- Joined: Tue Sep 27, 2011 11:47 am
Re: Scan multiple documents at once using separator sheets
Hi,
Any page can be understood as a separator sheet. That being said. if your page has low dpi, or very little spacial information, i.e just text, it will probably fail
Could you attach the page that you mentioned as a separator sheet and the following pages that are failed to be recognized?
Best,
Sami
Any page can be understood as a separator sheet. That being said. if your page has low dpi, or very little spacial information, i.e just text, it will probably fail
Could you attach the page that you mentioned as a separator sheet and the following pages that are failed to be recognized?
Best,
Sami
Who is online
Users browsing this forum: No registered users and 1 guest