Acquires a single image, from the currently selected Data Source.
public int TwainAcquireToGdPictureImage( IntPtr HANDLE );
Public Function TwainAcquireToGdPictureImage( ByVal HANDLE As IntPtr ) As Integer
|
Parameters |
Description |
|
HANDLE |
A Window Handle IE: Me.Handle. In most applications you can use nothing but on Citrix and WTS, this must be a top-level window or a child of a top level window. |
0: The image could not created. Use the GetStat(), TwainGetLastResultCode() and TwainGetLastConditionCode() functions for diagnosing the error.
Non-zero: GdPicture Image Identifier. The created image.
If success, set the created GdPicture Image as a GdPicture image.
By default, the default data source (DS) is opened, displays its dialog, and determines all the parameters of the acquisition and transfer.
If you want to (try to) hide the DS dialog, see TwainSetHideUI.
Before using this function check that the TWAIN state is >= 4 (TWAIN_SOURCE_OPEN)
To get the TWAIN state, use the TwainGetState() function.
To set the TWAIN state to 4, use the TwainOpenDefaultSource() or TwainOpenSource() function.
Acquire multiple image from the document feeder to a multipage tiff image
Dim oGdPictureImaging As New GdPictureImaging Dim ImageID As Integer Dim bContinue As Boolean = True Dim MultipageHandle As Integer Dim ImageCount As Integer oGdPictureImaging.SetLicenseNumber("XXX") 'Replace XXX by a demo or commercial license key oGdPictureImaging.TwainOpenDefaultSource(Me.Handle) oGdPictureImaging.TwainSetAutoFeed(True) 'Enable AutoFeed oGdPictureImaging.TwainSetAutoScan(True) 'To achieve the maximum scanning rate oGdPictureImaging.TwainSetPixelType(TwainPixelType.TWPT_BW) '1 bit bw image oGdPictureImaging.TwainEnableDuplex(True) 'Duplex acquisition if supported oGdPictureImaging.TwainSetHideUI(True) 'Asks to the device to hide his GUI ImageCount = 0 Do ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle) If ImageID <> 0 Then ImageCount = ImageCount + 1 If ImageCount = 1 Then MultipageHandle = ImageID oGdPictureImaging.TiffSaveAsMultiPageFile(MultipageHandle, "multipage.tif", TiffCompression.TiffCompressionAUTO) Else oGdPictureImaging.TiffAddToMultiPageFile(MultipageHandle, ImageID) oGdPictureImaging.ReleaseGdPictureImage(ImageID) End If End If Loop While oGdPictureImaging.TwainGetState() > TwainStatus.TWAIN_SOURCE_ENABLED oGdPictureImaging.ReleaseGdPictureImage(MultipageHandle) oGdPictureImaging.TwainCloseSource()
|
What do you think about this topic? Send feedback!
|
|
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.
|