ADF - Multiple 2 sided to multiple PDFs
ADF - Multiple 2 sided to multiple PDFs
I am evaluating your .Net product, version 6.5 for a VB.Net app.
Following your Twain examples I am able to scan multiple two sided documents from the ADF to one PDF file, or multiple single sided documents each to a separate PDF file, but I can't seem to find a way to scan multiple two sided document from the ADF each to a separate PDF file. Any ideas?
Following your Twain examples I am able to scan multiple two sided documents from the ADF to one PDF file, or multiple single sided documents each to a separate PDF file, but I can't seem to find a way to scan multiple two sided document from the ADF each to a separate PDF file. Any ideas?
Re: ADF - Multiple 2 sided to multiple PDFs
Hi,
Just starts 2 PDF before your scan process:
Then, you will be able to affect the current image to the desired PDF.
IE:
And don't forget to release the two created PDFs:
Hope this helps.
With best regards,
Loïc Carrère
Just starts 2 PDF before your scan process:
Code: Select all
PdfID = oGdPictureImaging.TwainPdfStart("output.pdf", True, "", "", "", "", "")
PdfID2 = oGdPictureImaging.TwainPdfStart("output.pdf", True, "", "", "", "", "")
Then, you will be able to affect the current image to the desired PDF.
IE:
Code: Select all
Call oGdPictureImaging.TwainAddGdPictureImageToPdf(PdfID, ImageID)
...
Call oGdPictureImaging.TwainAddGdPictureImageToPdf(PdfID2, ImageID)
And don't forget to release the two created PDFs:
Code: Select all
oGdPictureImaging.TwainPdfStop(PdfID)
oGdPictureImaging.TwainPdfStop(PdfID2)
With best regards,
Loïc Carrère
Re: ADF - Multiple 2 sided to multiple PDFs
Thank you, but I may have worded this wrong.
I need to scan a stack of 2 sided documents, with both sides of each document going to one file. So if I have 10 documents to scan, I end up with 10 files, each containing the 2 sides of one scanned document.
Thank you again for your help.
I need to scan a stack of 2 sided documents, with both sides of each document going to one file. So if I have 10 documents to scan, I end up with 10 files, each containing the 2 sides of one scanned document.
Thank you again for your help.
Re: ADF - Multiple 2 sided to multiple PDFs
Hi,
This kind of sample should work:
With best regards,
Loïc
This kind of sample should work:
Code: Select all
Dim ImageID As Integer
Dim NumPDF As Integer = 0
If oGdPictureImaging.TwainOpenDefaultSource(Me.Handle) Then
oGdPictureImaging.TwainSetHideUI(True)
oGdPictureImaging.TwainEnableDuplex(True)
oGdPictureImaging.TwainSetAutoFeed(True) 'Set AutoFeed Enabled
oGdPictureImaging.TwainSetAutoScan(True) 'To achieve the maximum scanning rate
oGdPictureImaging.TwainSetResolution(200)
oGdPictureImaging.TwainSetPixelType(TwainPixelType.TWPT_BW) 'Black & White
oGdPictureImaging.TwainSetBitDepth(1) ' 1 bpp
Do
NumPDF += 1
Dim PdfID As Integer = oGdPictureImaging.TwainPdfStart("output" & Trim(Str(NumPDF)) & ".pdf", True, "", "", "", "", "")
'front
ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
If ImageID <> 0 Then
Call oGdPictureImaging.TwainAddGdPictureImageToPdf(PdfID, ImageID)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
End If
'back
ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
If ImageID <> 0 Then
Call oGdPictureImaging.TwainAddGdPictureImageToPdf(PdfID, ImageID)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
End If
oGdPictureImaging.TwainPdfStop(PdfID)
Loop While oGdPictureImaging.TwainGetState > TwainStatus.TWAIN_SOURCE_ENABLED
Call oGdPictureImaging.TwainCloseSource()
MsgBox("Done !")
Else
MsgBox("can't open default source, twain state is: " & oGdPictureImaging.TwainGetState.ToString)
End If
Loïc
Re: ADF - Multiple 2 sided to multiple PDFs
Loïc,
Thank you, that works great.
Randy
Thank you, that works great.
Randy
Re: ADF - Multiple 2 sided to multiple PDFs
Well it works great once during my application session. I am opening a form as a dialog from another form to do the scanning. The first time I open the form and scan, it works great. But once I close the scanning dialog form and open it again, then run the scan, it locks up on the "ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)" line of code. My project is in VS 2008. Any ideas why it is locking up?
These definitions are at the top of my class:
These definitions are at the top of my class:
Code: Select all
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer
Here is the code:
Private Sub ScanTest()
Dim NumPDF As Integer = 0
Dim PdfID As Integer = 0
Dim count As Integer = 0
Try
If oGdPictureImaging.TwainOpenDefaultSource(Me.Handle) Then
InitScanConfig()
GdViewer1.ZoomMode = ViewerZoomMode.ZoomModeFitToViewer
oGdPictureImaging.TwainEnableDuplex(True)
Do
NumPDF += 1
PdfID = oGdPictureImaging.TwainPdfStart(strScannedFilesPath & "output" & Trim(Str(NumPDF)) & ".pdf", True, "", "", "", "", "")
'front
ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
If ImageID <> 0 Then
Call oGdPictureImaging.TwainAddGdPictureImageToPdf(PdfID, ImageID)
Call oGdPictureImaging.SaveAsJPEG(ImageID, strScannedFilesPath & "output" & Trim(Str(NumPDF)) & ".jpg", 90)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
End If
'back
ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
If ImageID <> 0 Then
Call oGdPictureImaging.TwainAddGdPictureImageToPdf(PdfID, ImageID)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
End If
oGdPictureImaging.TwainPdfStop(PdfID)
CloseCurrentImage()
Call DisplayImage(strScannedFilesPath & "output" & Trim(Str(NumPDF)) & ".pdf")
Loop While oGdPictureImaging.TwainGetState > TwainStatus.TWAIN_SOURCE_ENABLED
Call oGdPictureImaging.TwainCloseSource()
Else
oGdPictureImaging.TwainSelectSource(Me.Handle)
End If
Catch ex As Exception
ExceptionHandler(ex, "frmScanDocs_ScanCQs")
End Try
End Sub
Re: ADF - Multiple 2 sided to multiple PDFs
Hi,
maybe you should try to unload the source manager when the scan process is done.
This can be done adding:
just after:
If your problem persists, please create a new TWAIN issue thread as as explained here: viewtopic.php?t=1486
With best regards,
Loïc
maybe you should try to unload the source manager when the scan process is done.
This can be done adding:
Code: Select all
Call oGdPictureImaging.TwainUnloadSourceManager(Me.Handle)
Code: Select all
Call oGdPictureImaging.TwainCloseSource()
With best regards,
Loïc
Re: ADF - Multiple 2 sided to multiple PDFs
Loïc,
Great, that worked!
Thank you,
Randy
Great, that worked!
Thank you,
Randy
Re: ADF - Multiple 2 sided to multiple PDFs
Good news Randy !
Thank you for the feedback.
Cheers,
Loïc
Thank you for the feedback.
Cheers,
Loïc
Who is online
Users browsing this forum: No registered users and 1 guest