Advanced Scan

Methods
CancelAllPendingTransfers() CloseSourceManager() CloseWorkingProcess()
FeedPage() GetCustomDSData() GetCustomDSDataEx()
GetDeviceType() GetSourceNameItems() OpenSourceManager()
ResetImageLayout() RewindPage() SetCustomDSData()
SetCustomDSDataEx() SetFileXferInfo() SetImageLayout()
Properties
Brightness Contrast CurrentSourceName
DataSourceStatus DefaultSourceName Duplex
IfAutoBright IfAutoDiscardBlankpages IfAutoFeed
IfAutomaticBorderDetection IfAutomaticDeskew IfAutoScan
IfFeederLoaded IfPaperDetectable IfShowIndicator
IfUIControllable IfUseTwainDSM PendingXfers
PixelFlavor TransferMode Unit
XferCount
Events
OnPreAllTransfers OnPreTransfer OnSourceUIClose

Methods

CancelAllPendingTransfers()
Cancels all pending transfers.
Syntax .CancelAllPendingTransfers();
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
Usage notes This method is only valid in the events OnPreAllTransfers, OnPreTransfer and OnPostTransfer.
CloseSourceManager()
Closes and unloads Data Source Manager.
Syntax .CloseSourceManager();
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
Usage notes If this method is not called explicitly by the application, it'll be called automatically when the browser or tab closes.
CloseWorkingProcess()
Closes the scanning process to release resources on the machine.
Syntax .CloseWorkingProcess();
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v11.2 ✓ | v11.2 ✓ | v11.2 ✓ | v11.2 ✓ | v12.1
Usage notes In the HTML5 edition, Dynamic Web TWAIN uses a separate process to communicate with the scanners. When it's not scanning, you can choose to close this process to release the resources (CPU, memory, etc.) used on the machine.
FeedPage()
Ejects the current page and begins scanning the next page in the document feeder.
Syntax .FeedPage();
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes Use this method after OpenSource() is called and make sure IfFeederEnabled is true.
GetCustomDSData()
Gets custom DS data and saves the data in a specified file.
Syntax .GetCustomDSData(fileName);
Parameters string filename
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v10.0 ✓ | v10.0 ✓ | v11.0
Usage notes The path of the file used for storing custom DS data. For example DWObject.GetCustomDSData("C:\\customDSData");
GetCustomDSDataEx()
Gets custom DS data and returns it in a base64 encoded string.
Syntax .GetCustomDSDataEx();
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v10.0 ✓ | v10.0 ✓ | v11.0
Return value A base64 encoded string which represents the custom DS data.
GetDeviceType()
Retrieve the device type of the currently selected Data Source, it might be a scanner, a web camera, etc.
Syntax .GetDeviceType();
Parameters None
Return value number
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v7.0 ✓ | v10.0 ✓ | v11.0
Usage notes Please find below all available numbers and the descriptions:
0: Failed, please check ErrorString for details.
1: Digital Camera
2: Flatbed-only scanner
3: Flatbed, feeder, auto feed
4: Feeder-only scanner, auto feed
5: Flatbed, feeder, without auto feed
6: Feeder-only scanner, without auto feed
7: Webcam
GetSourceNameItems()
Gets the name of a Data Source by its index in Data Source Manager Source list.
Syntax .GetSourceNameItems(short index);
Parameters short index
The index of a Data Source in Data Source Manager Source list. For example
DWObject.GetSourceNameItems(0);
Return value string
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v7.0 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
Usage notes This method replaces SourceNameItems in old versions of Dynamic Web TWAIN.
OpenSourceManager()
Loads and opens Data Source Manager.
Syntax .OpenSourceManager();
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
Usage notes If application identification information needs to be set, it should be set before OpenSourceManager().
Dynamic Web TWAIN has built-in Wizard Mode. With Wizard Mode, OpenSourceManager() is called automatically when needed by methods like EnableSource() or SelectSource().
ResetImageLayout()
Reset the image layout in the Data Source back to default.
Syntax .ResetImageLayout();
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes To set the image layout manually, you can use SetImageLayout().
RewindPage()
If IfFeederEnabled property is true, the Source will return the current page to the input area and return the last page from the output area into the acquisition area.
Syntax .RewindPage();
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes Use this method after OpenSource() method and make sure IfFeederEnabled property is true.
SetCustomDSData()
Sets custom DS data to be used for scanning, the data is stored in a file. Custom DS data means a specific scanning profile.
Syntax .SetCustomDSData(string fileName);
Parameters string filename: The absolute path of the file where the custom Data Source data is stored.
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v10.0 ✓ | v10.0 ✓ | v11.0
Usage notes If you want to get custom DS data and save the data in a local file, you can check GetCustomDSData() method or GetCustomDSDataEx() method.
SetCustomDSDataEx()
Sets custom DS data to be used for scanning, the input string is base64 encoded. Custom DS data means a specific scanning profile.
Syntax .SetCustomDSDataEx(string strBase64);
Parameters string strBase64 : The input string which is base64 encoded.
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v10.0 ✓ | v10.0 ✓ | v11.0
Usage notes If you want to get custom DS data and save the data in a local file, you can check GetCustomDSData() method or GetCustomDSDataEx() method.
SetFileXferInfo()
Sets the absolute file name (including its path) and file format to be used in File Transfer Mode. Note that this method is valid only in File Transfer Mode. In File Transfer Mode, the image is transferred to the designated location on the disk directly instead of Dynamic Web TWAIN.
Syntax .SetFileXferInfo(string fileName, EnumDWT_FileFormat fileFormat);
Parameters string fileName
The name of the file to be used in the transfer. For example: "C:\\webtwain.jpg". When you write the name like this string + %d + string, then when you scan multiple files, the name will automatically change. For example: "C:\\webtwain" + <> + ".jpg" will result in "C:\\webtwain0.jpg","C:\\webtwain1.jpg", "C:\\webtwain2.jpg", etc. By doing this, you are now able to scan multiple files to the disk.
Starting in version 15.0, you can specify the naming pattern like "C:\\webtwain" + <%06d> + ".jpg" which will result in "C:\\webtwain000001.jpg","C:\\webtwain000002.jpg", "C:\\webtwain000003.jpg", etc.
EnumDWT_FileFormat fileFormat: for all available values, please check this page
Return value boolean
Example

DWObject.OpenSource();
DWObject.TransferMode = EnumDWT_TransferMode.TWSX_FILE;
if(DWObject.TransferMode == EnumDWT_TransferMode.TWSX_FILE){
    if(DWObject.SetFileXferInfo("C:\\Temp\\WebTWAIN<>.bmp",
        EnumDWT_FileFormat.TWFF_BMP)){
        DWObject.IfShowUI = true;        
        DWObject.AcquireImage(); 
    }
}
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes Make sure the format you set is supported by the Data Source (your scanner).
SetImageLayout()
Sets the left, top, right, and bottom sides of the image layout rectangle for the current Data Source. In other words, sets which area should be scanned. The image layout rectangle defines what portion of the Data Source's scanning area is acquired. Note that you should set Unit property before using this method.
Syntax .SetImageLayout(left, top, right, bottom);
Parameters number left: specifies the left side of the image layout rectangle .
number top: specifies the top side of the image layout rectangle .
number right: specifies the right side of the image layout rectangle .
number bottom: specifies the bottom side of the image layout rectangle .
Return value boolean
Example

DWObject.SelectSource();
DWObject.OpenSource();
DWObject.IfShowUI = false;
DWObject.Unit=EnumDWT_UnitType.TWUN_PIXELS;
DWObject.SetImageLayout(50, 50, 100, 100);
DWObject.AcquireImage();
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes This method uses Capability Negotiation underneath, thus is device-dependent. If a device doesn't support the customization of the scan area, this method might not work correctly.

Properties

Brightness
Returns or sets Brightness to be used for scanning by the Data Source.
Type number
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0 ✓ | 12.1
Usage notes Set this property after OpenSource() and before AcquireImage().
Typically the value to be set is -1000 ~ 1000.
Contrast
Returns or sets Contrast to be used for scanning by the Data Source.
Type number
Accessors Get Set
Usage notes Set this property after OpenSource() and before AcquireImage().
Typically the value to be set is -1000 ~ 1000.
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0 ✓ | 12.1
Usage notes Set this property after OpenSource() and before AcquireImage().
Typically the value to be set is -1000 ~ 1000.
CurrentSourceName
Returns the device name of current source. This is a read-only property.
Type string
Accessors Get
Usage notes If no source is currently selected, CurrentSourceName property returns "".
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
Usage notes If no source is currently selected, CurrentSourceName property returns "".
DataSourceStatus
Returns a value which indicates the Data Source status. This is a read-only property.
Type number
Accessors Get
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
Usage notes Allowed values :
0: The Data Source is closed
1: The Data Source is opened
2: The Data Source is enabled
3: The Data Source is acquiring images.
DefaultSourceName
Returns the name of the default source. This is a read-only property.
Type string
Accessors Get
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Duplex
Returns whether the source supports duplex. If yes, it further returns the level of duplex the Source supports (one pass or two pass duplex). This is a read-only property.
Type EnumDWT_DUPLEX (int)
Accessors Get
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes Available values.
TWDX_NONE (0): duplex is not supported TWDX_1PASSDUPLEX (1): 1-pass duplex TWDX_2PASSDUPLEX (2): 2-pass duplex
IfAutoBright
Returns or sets whether to enable the Source's Auto-brightness feature.
Type boolean
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes The default value is false.
IfAutoDiscardBlankpages
Returns or sets whether the Data Source (the scanner) discards blank images during scanning.
Type boolean
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v7.0 ✓ | v10.0 ✓ | v11.0
Usage notes The property works only if the device and its driver supports discarding blank pages. You can find whether your device supports this capbility from its user manual. Or, you can use the built-in methods of Dynamic Web TWAIN to detect blank images: IsBlankImageExpress.
IfAutoFeed
Returns or sets whether to enable the Data Source's automatic document feeding process.
Type number
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v7.0 ✓ | v10.0 ✓ | v11.0
Usage notes If the value of this property is true, the Data Source will automatically feed the next page from the document feeder after the previous page is acquired.
IfAutomaticBorderDetection
Returns or sets whether to enable the Data Source's automatic border detection feature.
Type boolean
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v7.0 ✓ | v10.0 ✓ | v11.0
Usage notes The property works only if the device and its driver support detecting the border automatically. You can find whether your device supports this capbility from its user manual.
If the value of this property is true, the Data Source (scanner) will automatically detect the border of the document on the flatbed and will only scan the area within the border.
IfAutomaticDeskew
Returns or sets whether to enable the Data Source's automatic skew correction feature.
Type boolean
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v7.0 ✓ | v10.0 ✓ | v11.0
Usage notes The property works only if the device and its driver supports deskewing automatically. You can find whether your device supports this capbility from its user manual.
If this property is set to true, the Data Source (scanner) will automatically correct the skew of the scanned images.
IfAutoScan
Returns or sets whether to enable the Data Source's automatic document scanning process.
Type boolean
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes Please Make sure IfFeederEnabled property is true before use this property.
IfFeederLoaded
Returns whether or not there are documents loaded in the Data Source's feeder when IfFeederEnabled and IfPaperDetectable are true. This is a read-only property.
Type boolean
Accessors Get
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes Make sure IfPaperDetectable is true before use this property.
IfPaperDetectable
Returns whether the Source has a paper sensor that can detect documents on the ADF or Flatbed. This is a read-only property.
Type boolean
Accessors Get
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
IfShowIndicator
Returns or sets whether the Source displays a progress indicator during acquisition and transfer. This property works only when IfShowUI is set to false.
Type boolean
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes If you set both IfShowUI and IfShowIndicator to false, The progress indicator will not appear;
If you set IfShowUI to false but IfShowIndicator to true, The progress indicator will appear;
If you set IfShowUI to true, this property will no longer work. The progress indicator always appears.
IfUIControllable
Returns whether the Data Source supports acquisitions with the UI (User Interface) disabled. 'false' indicates that the Data Source only supports acquisitions with the UI enabled. This is a read-only property.
Type boolean
Accessors Get
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes Read this property after OpenSource().
IfUseTwainDSM
Returns or sets whether the new TWAIN DSM (Data Source Manager) is used for acquisitions. The new TWAIN DSM is a .dll file called 'TWAINDSM.dll'. By default, the old DSM is used ('twain_32.dll' under 'C:\Windows').
Type boolean
Accessors Get Set
Usage notes Set this property before any TWAIN related methods or properties are used.
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v6.2 ✓ | v10.0 ✓ | v11.0
PendingXfers
Returns the number of transfers the Data Source is ready to supply upon demand. This is a read-only property.
Type Short
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes This property is only valid in the event OnPostTransfer.
The Data Source returns -1 if it is not sure how many transfers are pending. Scanners with ADF (Automatic Document Feeder) typically return -1 if the current image is not the last one.
PixelFlavor
Returns or sets the pixel flavor to be used for acquiring images.
Type Short
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes Available values:
0: Chocolate. Zero pixel represents darkest shade
1: Vanilla. Zero pixel represents lightest shade.
TransferMode
Returns or sets the Data Source's transfer mode.
Type EnumDWT_TransferMode
TWSX_NATIVE: NATIVE mode is the default mode. In this mode, the whole image is transfered in a single memory block.
TWSX_FILE: DISK FILE mode is not required by TWAIN specification. In this mode, the image is transfered to a specified file directly. The disk file mode is ideal when transferring large images that might encounter memory limitations with Native mode. Check out SetFileXferInfo for more information.
TWSX_MEMORY: MEMORY mode is also required by TWAIN, like NATIVE mode. Although this mode is the most complex, Dynamic TWAIN handles the transfer details, making it as simple as NATIVE mode.
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0
Usage notes The default value for TransferMode is TWSX_NATIVE (0).
For DISK FILE mode - TWSX_FILE (1), since it is not required by TWAIN, the application needs to make sure it is supported by the current Source. One way to do this is to check the TransferMode property after OpenSource() and see if it is still TWSX_FILE (1).
Unit
Returns or sets the unit of measure for all quantities.
Type EnumDWT_UnitType (short)
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0
Usage notes Available values:
EnumDWT_UnitType.TWUN_INCHES: inches(Default)
EnumDWT_UnitType.TWUN_CENTIMETERS: centimeters
EnumDWT_UnitType.TWUN_PICAS: picas
EnumDWT_UnitType.TWUN_POINTS: points
EnumDWT_UnitType.TWUN_TWIPS: twips
EnumDWT_UnitType.TWUN_PIXELS: pixels
EnumDWT_UnitType.TWUN_MILLIMETERS: millimeters
XferCount
Returns and sets the number of images your application is willing to accept.
Type Short
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0 ✓ | v12.1
Usage notes Allowed values are between -1 and 215. '-1' indicate multiple images.

Events

OnPreAllTransfers
This event is triggered when all images are scanned and ready to be transferred.
Syntax .RegisterEvent('OnPreAllTransfers',function(){...});
Arguments None
Example
DWObject.RegisterEvent('OnPreAllTransfers', function() {
    DWObject.CancelAllPendingTransfers();
});
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
Usage notes Multiple transfers may occur when ADF(Auto Document Feeder) is enabled or there are more than one frames in a page. In those cases, OnPreTransfer is triggered multiple times but OnPreAllTransfers is triggerred just once. This is the place to call CancelAllPendingTransfers().
OnPreTransfer
This event is triggered when a page has been scanned and ready to be transferred.
Syntax .RegisterEvent('OnPreTransfer',function(){...});
Arguments None
Example
DWObject.RegisterEvent('OnPreTransfer', function() {
    DWObject.CancelAllPendingTransfers();
});
Usage notes This is where to check PendingXFERs, ImageLayoutDocumentNumber ImageLayoutFrameLeft, ImageLayoutFrameTop, ImageLayoutFrameRight, ImageLayoutFrameBottom, ImageLayoutPageNumber, ImageLayoutFrameNumber.
This is also the place to call CancelAllPendingTransfers().
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v5.2 ✓ | v10.0 ✓ | v11.0 ✓ | v11.0 ✓ | v12.1
Usage notes This is where to check PendingXFERs, ImageLayoutDocumentNumber ImageLayoutFrameLeft, ImageLayoutFrameTop, ImageLayoutFrameRight, ImageLayoutFrameBottom, ImageLayoutPageNumber, ImageLayoutFrameNumber.
This is also the place to call CancelAllPendingTransfers().
OnSourceUIClose
This event is triggered when the User Interface of the scanner source is closed manually by the user.
Syntax .RegisterEvent('OnSourceUIClose',function(){...});
Arguments None
Example
DWObject.RegisterEvent('OnSourceUIClose', function() {
    ...;
});
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v8.0.1 ✓ | v10.0 ✓ | v11.0

results matching ""

    No results matching ""

    results matching ""

      No results matching ""