here are your code
Code: Select all
Private Sub Command12_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command12.Click
'Here we will scan in a 1bpp form adf to multiple page pdf file
Dim ImageID As Integer
Dim PdfID As Integer
If oGdPictureImaging.TwainOpenDefaultSource(Me.Handle) Then
InitScanConfig()
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
PdfID = oGdPictureImaging.TwainPdfStart("output.pdf", True, "", "", "", "", "")
Do
ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
If ImageID <> 0 Then
Call ApplyImageFilters(ImageID)
If chkPreview.CheckState = 1 Then Call DisplayImage(ImageID)
Call oGdPictureImaging.TwainAddGdPictureImageToPdf(PdfID, ImageID)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
End If
Loop While oGdPictureImaging.TwainGetState > TwainStatus.TWAIN_SOURCE_ENABLED
oGdPictureImaging.TwainPdfStop(PdfID)
Call oGdPictureImaging.TwainCloseSource()
MsgBox("Done !")
Else
MsgBox("can't open default source, twain state is: " & oGdPictureImaging.TwainGetState.ToString)
End If
End Sub
TwainPdfStart
TwainAddGdPictureImageToPdf
TwainPdfStop
Is there a workaround ?