TwainAcquireToGdPictureImage Method

See Also     Examples     Applies To

Acquires a single image, from the currently selected Data Source.

Syntax

object.TwainAcquireToGdPictureImage (hwnd)

The TwainAcquireToGdPictureImage syntax has these parts:

Part Description
object Required. An object expression that evaluates to an object in the Applies To list.
hwnd Optional. Long. Default value is 0. A Win32 Window Handle. In most applications you can use 0 but on Citrix and WTS, this must be a top-level window or a child of a top level window.

Returns

Long.
0: The image could not created. Use the GetStat(), TwainGetLastResultCode() and TwainGetLastConditionCode() functions for diagnosing the error.
Non-zero: GdPicture Image handle. Handle of the created image.

Remarks

If success, set the created GdPicture Image as the native 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.

Category

TWAIN Functions

Visual Basic Sample

Acquire multiple image from the document feeder to a multipage PDF


Dim nImageID As Long

Object.TwainOpenDefaultSource
Object.TwainSetAutoFeed (True) 'Enable AutoFeed
Object.TwainSetAutoScan (True) 'To  achieve the maximum scanning rate
Object.TwainSetCurrentPixelType (TWPT_RGB) '24 bit color image
Object.TwainEnableDuplex (True) 'Duplex acquisition if supported
Object.TwainSetHideUI (True) 'Asks to the device to hide his GUI

Call Object.TwainPdfStartEx("acquire.pdf", "PdfTitle", "PdfCreator", "PdfAuthor", "PdfProducer")
Do
  nImageID = Object.TwainAcquireToGdPictureImage(Me.hwnd)
  If nImageID <> 0 Then
     Object.TwainAddGdPictureImageToPdf (nImageID)
     Object.CloseImage (nImageID)
  End If
Loop While Object.TwainGetState() > 5

Object.TwainPdfStop
Object.TwainCloseSource
Acquire multiple image from the document feeder to a multipage tif image

Dim nImageID As Long
Dim nImageCount As Long

Object.TwainOpenDefaultSource
Object.TwainSetAutoFeed (True) 'Enable AutoFeed
Object.TwainSetAutoScan (True) 'To  achieve the maximum scanning rate
Object.TwainSetCurrentPixelType (TWPT_BW) '1 bit bw image
Object.TwainEnableDuplex (True) 'Duplex acquisition if supported
Object.TwainSetHideUI (True) 'Asks to the device to hide his GUI

nImageCount = 0
Do
  nImageID = Object.TwainAcquireToGdPictureImage(Me.hwnd)
  If nImageID <> 0 Then
     nImageCount = nImageCount + 1
     If nImageCount = 1 Then
        Call Object.TiffSaveAsNativeMultiPage("acquire.tif", CompressionCCITT4)
     Else
        Object.TiffAddToNativeMultiPage (nImageID)
     End If
     Object.CloseImage (nImageID)
  End If
Loop While Object.TwainGetState() > 5

Object.TiffCloseNativeMultiPage()
Object.TwainCloseSource






© Copyright 2008 GdPicture All rights reserved.
Documentation MAP.