Web Demos

BARCODE READER SDK DEMO

Explore the flexibe barcode reading settings to optimize for your specific usage scenario.

WEB TWAIN SDK DEMO

Try the most popular web scanner features: scan images, import local images and PDF files, edit, save to local, upload to database, and etc.

BARCODE READER JAVASCRIPT DEMO

Transform any camera-equipped devices into real-time, browser-based barcode and QR code scanners.

MRZ SCANNER WEB DEMO

Detects the machine-readable zone of a passport, scans the text, and parses into human-readable data.

APP STORE DEMOS

BARCODE READER SDK FOR IOS

BARCODE READER SDK FOR ANDROID

VIEW MORE DEMOS >
Dev Center
Table of contents

{WebTwainObject} Buffer Manage

The properties and methods on this page live in the namespace {WebTwainObject}. {WebTwainObject} denotes the WebTwain instance. Learn about how to create a web twain object.

All APIs on this page support Android Service from version 18.2.

Methods

       
ClearImageTags() RenameTag() RemoveTag() GetTagList()
FilterImagesByTag() ClearFilter() SetDefaultTag() TagImages()
GetImageBitDepth() GetImageSize() GetImageSizeWithSpecifiedType() GetSelectedImagesSize()
GetImageHeight() GetImageWidth() GetImagePartURL() GetImageURL()
GetImageXResolution() GetImageYResolution() GetSkewAngle() GetSkewAngleEx()
ImageIDToIndex() IndexToImageID() IsBlankImage() IsBlankImageExpress()
SelectAllImages() MoveImage() SwitchImage() RemoveImage()
RemoveAllImages() RemoveAllSelectedImages() SelectImages() GetTagListByIndex()
CreateDocument() OpenDocument() GetCurrentDocumentName() RenameDocument()
RemoveDocument() GetDocumentInfoList() CopyToDocumentAsync() MoveToDocumentAsync()
IsBlankImageAsync()      

Properties

       
BlankImageCurrentStdDev BlankImageMaxStdDev BlankImageThreshold BufferMemoryLimit
CurrentImageIndexInBuffer HowManyImagesInBuffer IfAllowLocalCache SelectedImagesIndices
MaxImagesInBuffer      

Events

       
OnBufferChanged OnBitmapChanged OnIndexChangeDragDropDone OnTopImageInTheViewChanged

IndexToImageID

Return the imageId of an image specified by the index.

Syntax

IndexToImageID(index: number): number;

Parameters

index: The index of the image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v15.0+ v15.0+ v15.0+ v15.0+

ImageIDToIndex

Return the index of an image specified by the imageId.

Syntax

ImageIDToIndex(imageId: number): number;

Parameters

imageId: The imageId of the image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v15.0+ v15.0+ v15.0+ v15.0+

Usage notes

An imageId is unique and won’t change as long as the Dynamsoft Service process is running. It’s a better way to keep track of an image than the index which changes easily.


RenameTag

Rename a tag.

Syntax

RenameTag(oldName:string, newName:string): boolean;

Parameters

oldName: Specify the tag to change.

newName: Specify the new tag name.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v16.2+ v16.2+ v16.2+ v16.2+

RemoveTag

Remove the specified tag from one or more images(if not specified, remove from all).

Syntax

RemoveTag(tagName: string, indices?: number[]):boolean

Parameters

tagName: Specify the tag to be removed.

indices: Specify the index.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v17.0+ v17.0+ v17.0+ v17.0+

Usage Notes

If the index is not specified, the tag will be removed from all images. If the index is specified, the tag will be removed from the specified image(s).


GetTagList

Return the status of all current tags.

Syntax

GetTagList(): TagInfo[];

Arguments

TagInfo: Please refer to TagInfo.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v17.0+ v17.0+ v17.0+ v17.0+

ClearImageTags

Remove all tags from the specified image.

Syntax

ClearImageTags(index: number): boolean;

Parameters

index: Specify the image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v15.2+ v15.2+ v15.2+ v15.2+

FilterImagesByTag

Filter images by the specified tag.

Syntax

FilterImagesByTag(tag: string): boolean;

Parameters

tag: The tag used as the filter. If nothing or an empty string is used, the filter is cleared.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v15.2+ v15.2+ v15.2+ v15.2+

ClearFilter

Stop filtering images by tag. Return an array of UUID of images under the viewer.

Syntax

ClearFilter(): number[];

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v16.2+ v16.2+ v16.2+ v16.2+

SetDefaultTag

Set a default tag for newly incoming images.

Syntax

SetDefaultTag(tag: string): boolean;

Parameters

tag: Specifies the tag.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v15.2+ v15.2+ v15.2+ v15.2+

TagImages

Add a tag to specified images.

Syntax

TagImages(indices: number[], tag: string): boolean;

Parameters

indices: Specifies images to be tagged.

tag: Specify the tag.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v15.2+ v15.2+ v15.2+ v15.2+

GetImageBitDepth

Return the pixel bit depth of the specified image.

Syntax

GetImageBitDepth(index: number): number;

Parameters

index: Specify the image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v6.2+ v6.2+ v6.2+ v6.2+ v6.2+

GetImageHeight

Return the height (in pixels) of the specified image.

Syntax

GetImageHeight(index: number): number;

Parameters

index: Specify the image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v6.2+ v6.2+ v6.2+ v6.2+ v6.2+

GetImageWidth

Return the width (in pixels) of the specified image.

Syntax

GetImageWidth(index: number): number;

Parameters

index: Specify the image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v6.2+ v6.2+ v6.2+ v6.2+ v6.2+

GetImageXResolution

Return the horizontal resolution of the specified image.

Syntax

GetImageXResolution(index: number): number;

Parameters

index: Specify the image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v8.0+ v8.0+ v8.0+ v8.0+ v8.0+

GetImageYResolution

Return the vertical resolution of the specified image.

Syntax

GetImageYResolution(index: number): number;

Parameters

index: Specify the image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v8.0+ v8.0+ v8.0+ v8.0+ v8.0+

GetSkewAngle

Return the skew angle of the specified image.

Syntax

GetSkewAngle(
    index: number,
    successCallback?: (angle: number) => void,
    failureCallback?: (errorCode: number, errorString: string) => void
): number | void;

Parameters

index: Specify the image.

successCallback: A callback function that is executed if the request succeeds.

  • angle: The skew angle.

failureCallback: A callback function that is executed if the request fails.

  • errorCode: The error code.
  • errorString: The error string.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v9.0+ v9.0+ v9.0+ v9.0+ v9.0+

GetSkewAngleEx

Return the skew angle of the specified rectangle on the specified image.

Syntax

GetSkewAngleEx(
    index: number,
    left: number,
    top: number,
    right: number,
    bottom: number,
    successCallback?: (angle: number) => void,
    failureCallback?: (errorCode: number, errorString: string) => void
): number | void;

Parameters

index: Specify the image.

left: The x-coordinate of the upper-left corner of the rectangle.

top: The y-coordinate of the upper-left corner of the rectangle.

right: The x-coordinate of the lower-right corner of the rectangle.

bottom: The y-coordinate of the lower-right corner of the rectangle.

successCallback: A callback function that is executed if the request succeeds.

  • angle: The skew angle.

failureCallback: A callback function that is executed if the request fails.

  • errorCode: The error code.
  • errorString: The error string.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v9.0+ v9.0+ v9.0+ v9.0+ v9.0+

Usage notes

After you get the skew angle of an image, you can rotate it with the method Rotate to perform deskewing.


GetImageSize

Calculate the size in bytes of the specified image assuming it’s resized to the given dimensions.

Syntax

GetImageSize(index: number, width: number, height: number): number;

Parameters

index: Specify the image.

width: Specify the width.

height: Specify the height.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
all versions all versions all versions all versions all versions

GetImageSizeWithSpecifiedType

Calculate the size in bytes of the specified image assuming an expected file type.

Syntax

GetImageSizeWithSpecifiedType(index: number, type: Dynamsoft.DWT.EnumDWT_ImageType | number): number;

Parameters

index: Specify the image.

type: Specify the expected file type.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
all versions all versions all versions all versions all versions

GetSelectedImagesSize

Calculate the size in bytes of all selected images assuming an expected file type.

Syntax

GetSelectedImagesSize(type: Dynamsoft.DWT.EnumDWT_ImageType | number): number;

Parameters

type: Specify the expected file type.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v6.0+ v6.0+ v6.0+ v6.0+ v6.0+

Usage notes

If the calculation fails, -1 is returned.


GetImagePartURL

Return the internal URL of the specified image.

Syntax

GetImagePartURL(index: number, width?: number, height?: number): string;

Parameters

index: Specify the image.

width: The width of the image (>150 px).

height: The height of the image (>150 px).

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v14.3.1+ v13.0+ v13.0+ v13.0+ v13.0+

Usage notes

The returned URL looks like this: ‘dwt://dwt_trial_13000404/img?id=306159652&index=0&t=1502184632022’.

You get the original size (a, b) of the image in PNG format in Service Mode

  • if either width or height is not set or
  • if either width or height is set to -1 or
  • if either width or height is larger than the original width or height

Otherwise, you get the image with the specified width (x) or height (y) while keeping the same aspect ratio: if x/a < y/b, return the image (x, b*x/a); if x/a > y/b, return the image (a*y/b, y)


GetImageURL

Return the direct URL of the specified image.

Syntax

GetImageURL(index: number, width?: number, height?: number): string;

Parameters

index: Specify the image.

width: The width of the image (>150 px).

height: The height of the image (>150 px).

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v12.0+ v12.0+ v12.0+ v12.1+

Usage notes

The returned URL looks like this: “https://127.0.0.1:18623/dwt/dwt_17110818/img?id=795151779&index=1&t=1640936181588”.

You get the original size (a, b) of the image in PNG format in Service Mode

  • if either width or height is not set or
  • if either width or height is set to -1 or
  • if either width or height is larger than the original width or height

Otherwise, you get the image with the specified width (x) or height (y) while keeping the same aspect ratio: if x/a < y/b, return the image (x, b*x/a); if x/a > y/b, return the image (a*y/b, y)


SelectAllImages

Select all images and return the indices. Viewer will be scrolled to the last image.

Syntax

SelectAllImages(): number[];

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v15.3+ v15.3+ v15.3+ v15.3+

SelectImages

Select the specified images.

Syntax

SelectImages(indices: number[]): boolean;

Parameters

indices: Specify one or multiple images

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v16.0+ v16.0+ v16.0+ v16.0+ v16.0+

MoveImage

Change the position of an image in the buffer.

Syntax

MoveImage(from: number, to: number): boolean;

Parameters

from: Specify the original position by index.

to: Specify the target position by index.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v4.0+ v10.0+ v11.0+ v11.0+ v12.1+

SwitchImage

Exchange the positions of two images.

Syntax

SwitchImage(index1: number, index2: number): boolean;

Parameters

index1: Specify the 1st image.

index2: Specify the 2nd image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v5.0+ v10.0+ v11.0+ v11.0+ v12.1+

RemoveImage

Remove the specified image.

Syntax

RemoveImage(index: number): boolean;

Parameters

index: Specify the image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v4.0+ v10.0+ v11.0+ v11.0+ v12.1+

RemoveAllImages

Remove all images.

Syntax

RemoveAllImages(): boolean;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v4.0+ v10.0+ v11.0+ v11.0+ v12.1+

RemoveAllSelectedImages

Remove all selected images.

Syntax

RemoveAllSelectedImages(): boolean;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v4.0+ v10.0+ v11.0+ v11.0+ v12.1+

CurrentImageIndexInBuffer

Return the index of the current image in the buffer or set the image specified by index as the current image.

Syntax

CurrentImageIndexInBuffer: number;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v4.0+ v4.0+ v4.0+ v4.0+ v4.0+

HowManyImagesInBuffer

Return how many images are held in the buffer

Syntax

readonly HowManyImagesInBuffer: number;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v4.0+ v4.0+ v4.0+ v4.0+ v4.0+

MaxImagesInBuffer

Return or set how many images can be held in the buffer.

Syntax

MaxImagesInBuffer: number;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v4.0+ v4.0+ v4.0+ v4.0+ v4.0+

Usage notes

When acquiring images and the number of images goes beyond the value set to MaxImagesInBuffer, new images will replace old images starting from the 1st one.


SelectedImagesIndices

Return the indices of the selected images.

Syntax

readonly SelectedImagesIndices: number[];

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v16.0+ v16.0+ v16.0+ v16.0+ v16.0+

SelectionRectAspectRatio

Specify a aspect ratio to be used when selecting a rectangle on an image.

Syntax

SelectionRectAspectRatio: number;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v10.0+ v10.0+ v11.0+ v11.0+ v12.1+

BlankImageCurrentStdDev

Return the deviation of the pixels in the current image.

Syntax

readonly BlankImageCurrentStdDev: number;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v8.0+ v8.0+ v8.0+ v8.0+ v8.0+

Usage notes

This property is only valid after IsBlankImageExpress or IsBlankImage() is called.


BlankImageMaxStdDev

Return or set the maximum deviation of the pixels in an image which is used to determine whether the image is blank.

Syntax

BlankImageMaxStdDev: number;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v5.2+ v5.2+ v5.2+ v5.2+ v5.2+

Usage notes

[0, 100] is the interval of allowed values, inclusive. 0 gives a single-color image. The default value is 1.

This property is only valid before IsBlankImageExpress is called.


BlankImageThreshold

Returns or sets the dividing line between black and white.

Syntax

BlankImageThreshold: number;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v5.2+ v5.2+ v5.2+ v5.2+ v5.2+

Usage notes

[0, 255] is the interval of allowed values, inclusive. The default value is 128. This property is only valid before IsBlankImageExpress is called.


BufferMemoryLimit

Return or set how much physical memory is allowed for storing images currently loaded in Dynamic Web TWAIN. Once the limit is reached, images will be cached on the hard disk.

Syntax

BufferMemoryLimit: number;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v10.1+ v10.1+ v10.1+ v11.0+ v12.1+

Usage notes

Set this property only when you have a very small physical memory (< 2GB) or a very big one (>4GB). The more memory is allowed, the better the performance will be. The default value is set to 800 (MB), anything beyond 800MB gets compressed, encrypted and cached on the local disk.

All cached data is encrypted and can only be read by Dynamic Web TWAIN and it will be destroyed when it is no longer used.


IsBlankImage

Check whether the specified image is blank.

Syntax

IsBlankImage(index: number): boolean;

Parameters

index: Specify the image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v5.2+ v5.2+ v5.2+ v5.2+ v5.2+

IsBlankImageAsync

Check whether the specified image is blank.

Syntax

IsBlankImageAsync(index: number, 
  options?: {
    minBlockHeight?: number,
    maxBlockHeight?: number,
}): Promise < boolean > ;

Parameters

index: Specify the image in buffer to be analyzed. minBlockHeight: Minimum height of mark to be detected. maxBlockHeight: Maximum height of mark to be detected.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) Android
N/A v18.4+ N/A N/A N/A N/A

Usage Notes This API uses a different algorithm than the one used in IsBlankImage and IsBlankImageExpress, which allows you to judge a page as not blank if it has marks within a defined size. If the mark on the page satisfies the comparison parameters, then the page will be deemed not blank.

Example: The mark on the page is 11 pixels tall, minBlockHeight is set to 9 pixels and maxBlockHeight is set to 13 pixels, the page will be marked as not blank.


IsBlankImageExpress

Check whether the specified image is blank.

Syntax

IsBlankImageExpress(index: number): boolean;

Parameters

index: Specify the image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v10.0+ v10.0+ v10.0+ v10.0+ v10.0+

Usage notes

IsBlankImage is more accurate than IsBlankImageExpress but it works slower.

BlankImageCurrentStdDev should be read after either IsBlankImage() or IsBlankImageExpress.

If you believe an image should be blank but IsBlankImage() or IsBlankImageExpress is returning false, you can read BlankImageCurrentStdDev for that image and then set a bigger value to BlankImageMaxStdDev.

Both BlankImageCurrentStdDev and BlankImageMaxStdDev range from 0 to 100.

If the image is not blank and it is not black and white, IsBlankImage() or IsBlankImageExpress may return true. In that case, you can increase the BlankImageThreshold value so that the image is not detected as blank.


IfAllowLocalCache

Return or set whether the feature of disk caching is enabled.

Syntax

IfAllowLocalCache: boolean;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v10.0+ v10.0+ v10.0+ v11.0+ v12.1+

Usage notes

The default value of IfAllowLocalCache is true. When the property is true, you can scan as many images as you want as long as you have a big enough disk.
The default threshold is set to 800 (MB), anything beyond 800MB gets compressed, encrypted and cached on the local disk.
If necessary, you can set the threshold using BufferMemoryLimit for better performance.
All cached data is encrypted and can only be read by Dynamic Web TWAIN and it will be destroyed when it is no longer used.


OnBufferChanged

An enhanced callback triggered when a change occurs in the buffer.

Syntax

RegisterEvent('OnBufferChanged',
    function (bufferChangeInfo: BufferChangeInfo) {}
): boolean;

Parameters

bufferChangeInfo: Details about the buffer change. TagInfo: Please refer to BufferChangeInfo.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v18.0+ v16.2+ v16.2+ v16.2+ v16.2+

Usage notes

Action types include

  • add: New pages are added to the buffer.
  • remove: The existing pages are removed.
  • modify: The existing pages are modified.
  • shift: The existing pages are reordered or the selected pages are changed.
  • filter: The existing pages are filtered by a tag.

OnBitmapChanged

A built-in callback triggered when the current image in buffer is changed like flipped, cropped, rotated, etc. or a new image has been acquired.

Syntax

RegisterEvent('OnBitmapChanged',
    function (
        indexString: number[],
        type: number,
        index: number
    ) {}
): boolean;

Parameters

indexString: Array of the changed index(indices).

type: Operation type. 1 means new image(s) were added at the tail, 2 means image(s) were inserted before the current index, 3 means image(s) are deleted, 4 means image(s) are modified,

index: Index of the current image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v8.0+ v10.0+ v10.0+ v11.0+ v12.1+

Example

DWObject.RegisterEvent(
  "OnBitmapChanged",
  function (strUpdatedIndex, operationType, sCurrentIndex) {
    console.log("Image " + sCurrentIndex + " has changed!");
  }
);

OnTopImageInTheViewChanged

A built-in callback triggered when the top index currently displayed in the viewer changes.

Syntax

RegisterEvent('OnTopImageInTheViewChanged',
    function (index: number) {}
): boolean;

Parameters

index: Index of the current image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
v5.1+ v10.1+ v11.0+ v11.0+ v12.1+

Usage notes

This API does not work if the view mode of the viewer is set to -1 by -1.


OnIndexChangeDragDropDone

A built-in callback triggered when images in the buffer are dragged to new positions.

Syntax

RegisterEvent('OnIndexChangeDragDropDone',
    function (indexPairs: Pair[]) {}
): boolean;

Pair: [from: number, to: number];

Parameters

indexPairs: The list of index changes.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v15.0+ v15.0+ v15.0+ v15.0+

GetTagListByIndex

Return the tag(s) of a specified image.

Syntax

GetTagListByIndex(index: number):string[]

Parameters

index: Index of the image.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v17.2+ v17.2+ v17.2+ v17.2+

Example

DWObject.GetTagListByIndex(0);

CopyToDocumentAsync

Copy specified images to another document.

Syntax

CopyToDocumentAsync(from: string, to: string): Promise<void>;

CopyToDocumentAsync(from: string, to: string, sourceIndices: number[]): Promise<void>;

CopyToDocumentAsync(from: string, to: string, targetIndex: number): Promise<void>;

CopyToDocumentAsync(from: string, to: string, sourceIndices: number[], targetIndex: number): Promise<void>;

Parameters

from: The source document name.

to: The destination document name.

sourceIndices: The indices of the images to be copied.

targetIndex: The index at which the source images should be inserted into the new document. If not specified, the images will be appended to the destination document.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) Android
not supported v18.4+ v18.4+ v18.4+ v18.4+ v18.4+

CreateDocument

Create a document for the scanned image(s).

Syntax

CreateDocument(documentName:string):boolean;

Parameters

documentName: Specify the document name.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v17.2+ v17.2+ v17.2+ v17.2+

Example

//Save the scanned image(s) under 'Document1'.
DWObject.CreateDocument("Document1");
DWObject.OpenDocument("Document1"); //Need to call OpenDocument after CreateDocument.
DWObject.AcquireImage(successCallback, failureCallback);
function successCallback() {
  console.log("successful");
}
function failureCallback(errorCode, errorString) {
  alert(errorString);
}

MoveToDocumentAsync

Move specified images to another document.

Syntax

MoveToDocumentAsync(from: string, to: string): Promise<void>;

MoveToDocumentAsync(from: string, to: string, sourceIndices: number[]): Promise<void>;

MoveToDocumentAsync(from: string, to: string, targetIndex: number): Promise<void>;

MoveToDocumentAsync(from: string, to: string, sourceIndices: number[], targetIndex: number): Promise<void>;

Parameters

from: The source document name.

to: The destination document name.

sourceIndices: The indices of the images to be moved.

targetIndex: The index at which the source images should be inserted into the new document. If not specified, the images will be appended to the destination document.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) Android
not supported v18.4+ v18.4+ v18.4+ v18.4+ v18.4+

OpenDocument

Use the specified document for the scanned image(s)

Syntax

OpenDocument(documentName:string):boolean;

Parameters

documentName: Specify the document name.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v17.2+ v17.2+ v17.2+ v17.2+

Example

//Save the scanned image(s) under 'Document2'.
DWObject.CreateDocument("Document1");
DWObject.CreateDocument("Document2");
DWObject.CreateDocument("Document3");
DWObject.OpenDocument("Document2"); //Need to call OpenDocument after CreateDocument.
DWObject.AcquireImage(successCallback, failureCallback);
function successCallback() {
  console.log("successful");
}
function failureCallback(errorCode, errorString) {
  alert(errorString);
}

GetCurrentDocumentName

Get the current document name. The default value is ‘dynamsoft-default-document’. Scanned image(s) are saved in this document by default if no document name is created.

Syntax

GetCurrentDocumentName():string;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v17.2+ v17.2+ v17.2+ v17.2+

RenameDocument

Rename a document.

Syntax

RenameDocument(oldDocumentName:string, newDocumentName:string):boolean;

Parameters

oldDocumentName: Specify the old document name.

newDocumentName: Specify the new document name.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v17.3+ v17.3+ v17.3+ v17.3+

RemoveDocument

Delete the specified document.

Syntax

RemoveDocument(documentName:string):boolean;

Parameters

documentName: Specify the document name.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v17.2+ v17.2+ v17.2+ v17.2+

GetDocumentInfoList

Get the list of all documents and their information.

Syntax

GetDocumentInfoList(): DocumentInfo[];

Arguments

DocumentInfo: Please refer to DocumentInfo.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux)
not supported v17.2+ v17.2+ v17.2+ v17.2+

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest Version (18.4)
    • Version 18.3
    • Version 18.1
    • Version 18.0
    • Version 17.3
    • Version 17.2.1
    • Version 17.1.1
    • Version 17.0
    • Version 16.2
    • Version 16.1.1
    Change +