Scanning to PDF
Posted: Thu May 24, 2007 9:04 am
Is there a way to scan documents to multiple page PDF ?
Code: Select all
Dim nImageID As Long
If Imaging1.TwainOpenDefaultSource() Then
Imaging1.TwainSetAutoFeed (True) 'Set AutoFeed Enabled
Imaging1.TwainSetAutoScan (True) 'To achieve the maximum scanning rate
Imaging1.TwainSetCurrentResolution (300)
Imaging1.TwainSetCurrentPixelType (TWPT_RGB) 'RGB
Imaging1.TwainSetCurrentBitDepth (8) ' 24 bpp
Imaging1.TwainPdfStart ("output.pdf")
Do
nImageID = Imaging1.TwainAcquireToGdPictureImage(Me.hWnd)
Call Imaging1.TwainAddGdPictureImageToPdf(nImageID)
Imaging1.CloseImage (nImageID)
Loop While Imaging1.TwainGetState > TWAIN_SOURCE_OPEN
Imaging1.TwainPdfStop
Call Imaging1.TwainCloseSource
MsgBox "Done !"
Else
MsgBox "can't open default source, twain state is: " & Trim(Str(Imaging1.TwainGetState))
End If