EZTwainX Methods

See also: creation, properties, events, deployment

Method Name Description Ver.
AcquireMultipage() => bool Acquire multiple pages and store them in the control. 1.40
AcquireMultipageFile(filename) => bool Scan multiple pages directly into a file, using the current scan settings. The format of the file is deduced from the file extension, which must be one of the supported multipage formats: TIFF (.tif, .tiff, .mpt), PDF, or DCX. This method has no effect on the images (if any) currently stored in the control, and does not load the scanned images into the control. 1.40
AcquireSingleImage() => bool Acquire a single image from the source device and store it in the control. 1.39
AppendDibHandle(hdib)

Append an image represented by a DIB handle (global handle pointing to a contiguous memory DIB) to the images held by the control. The appended image is selected as the active image.
EZTwainX takes ownership of the DIB: Do not use the handle again - calling any other function on that handle may cause a crash.
This function is useful for transferring images from EZTwain Pro to EZTwainX.

1.45
AsBase64String(format)
=> BSTR
Returns a base64 string encoding of a file containing the images in the control, in the specified file format (".jpg", ".tif", etc.) Useful for Uploading to the Server.
See also LoadFromBase64String.
1.64
AsUrlEncodedBase64String(format)
=> BSTR
Same as AsBase64String but the Base64 string is then URL-encoded. 1.80
AutoContrast Adjust the contrast and brightness of the current image to make it 'better'. 1.45
AutoCrop Crop the current image using a heuristic: Try to trim off areas of uniform color while keeping content. 1.44
ChooseSystemTwainDevice() => bool Display the TWAIN 'Select Source' dialog to allow user to specify default TWAIN device.
Note: This selects the default TWAIN device for the entire computer, not just for your application.
1.39
Clear() Delete all images held by the control. 1.42
CloseDevice Close the currently open TWAIN device, if any. 1.44
Crop(long x, long y, long w, long h) Replace the current image with a copy cropped to the given rectangle. x and y are the pixel coordinates of the upper left corner, w and h are the pixel width and height. Note that x or y can be negative. If the source rectangle extends outside the current image, the additional pixels are sourced as white. 1.43
DeletePage(long i) Delete the ith image (counting from 0) held by the control.
i=-1 means delete the last image, etc. (Pythonistas will recognize this convention.)
1.36
DeletePages(long i, long n) Delete n images starting with the ith image (counting from 0) held by the control.
i=-1 means starting from the last image, etc.
If n < 0, deletes abs(n) images preceding the ith image.
1.36
Deskew Automatically deskew the current image. 1.44
EditCopy() => bool Copy the current image to the clipboard. 1.41
EditPaste() => bool If the clipboard contains an image, copy it into the control, replacing any current images. 1.41
FlipHorizontal() Flip current image horizontally. 1.40
FlipVertical() Flip current image vertically. 1.40
InsertFromFile(long i, BSTR filename) => bool Insert the images in the file into the control, starting at position i. 0=first image, -1 means 'at the end'. 1.44
InsertPagesFromFile(
long i, BSTR filename,
long p, long n) => bool
Insert n images starting at position p in a file, into the control starting at position i. Positions begin at 0, -1 means 'last', and n=-1 means 'all'. 1.44
IsFeederLoaded()=>bool Check the current device and return True if paper is detected in the feeder. Return False if no scanner can be opened, or it does not have a feeder, or cannot detect paper. This method leaves the scanner open - until you do an Acquire, or call CloseDevice. 1.44
KeepCurrentPages() Obsolete - use AccumulateImages property instead.) 1.48
-1.49
LoadFromBase64String(str) Load images into the control from a file encoded as a base64 string.
See also: AsBase64String.
1.64
LoadFromFile(filename)
=> bool
Load image(s) from the file into the control. If filename is empty, prompts the user. 1.40
LoadPagesFromFile(filename, long i, long n)
=> bool
Load n pages into the control starting at the ith page in the file. If n = -1, loads as many as possible. 1.41
Negate() Negate (reverse colors) in the current image. 1.55
NextPage() => bool Select and display the next image in the control. (same as PageIndex = PageIndex+1) 1.40
PrevPage() => bool Select and display the previous image in the control. 1.40
PrintToDefault(jobname) => bool Print image(s) immediately to the default printer, without displaying a print dialog. 1.41
PrintWithDialog(jobname) => bool Print image(s) using the standard print dialog. 1.41
RecognizeText => BSTR Recognize (OCR) the active image and return the text.
Requires Transym TOCR be installed on client computer.
1.56
Refresh() Update the display - useful if EnableAutoRefresh=False 1.64
ResetTrialLicense Display a dialog allowing a Trial License Extension key to be entered. 1.36
Rotate180() Rotate current image 180 degrees. 1.40
RotateClockwise90() Rotate current image clockwise 90 degrees. 1.40
RotateLeft(double d) Rotate the current image left (counter-clockwise) by d degrees. d must be a multiple of 90.
Changed to take an angle (double) in degrees:
1.36
1.41
RotateRight(double d) Rotate the current image right (clockwise) by d degrees. d must be a multiple of 90.
Changed to take an angle (double) in degrees:
1.36
1.41
SavePageToFile(BSTR filename) => bool Save the current image to a file. Because this method always writes exactly one image, it can save to any supported format: BMP, DCX, GIF, JPEG (JPG), PDF, PNG, or TIFF. If the filename is null, the user will be presented with a standard File-Save dialog. 1.43
SavePagesToFile(
long i, long n, BSTR filename) => bool
Save n images starting with image i to a file. EZTwainX deduces the format from the extension of the file: .bmp, .gif, .jpg, .pdf, etc. If n > 1, the format must be a supported multipage format: TIFF, PDF, or DCX.
If the filename is null, the user will be presented with a standard File-Save dialog.
1.43
SaveToFile(BSTR filename) => bool Save all images to file. EZTwainX deduces the format from the extension of the file: .bmp, .gif, .jpg, .pdf, etc. If PageCount > 1, the format must be a supported multipage format: TIFF, PDF, or DCX.
If the filename is null, the user will be presented with a standard File-Save dialog.
1.39
SelectImage(long i) Select the ith image (from 0) in the control as the active image. 1.55
SeBackColorRGB(long r, long g, long b) Set the background color of the control using RGB values (0..255 for each component). 1.63
UploadAddCookie(BSTR cookie) Add a 'cookie' HTTP header to the next upload i.e. a header of the form Cookie: cookie
See e.g. UploadToURL below.
1.57
UploadAddHeader(BSTR hdrline) Add an HTTP header line to the next upload. See e.g. UploadToURL below.
To send cookies for authentication, use UploadAddCookie.
1.55
UploadExtraField(
BSTR name, BSTR value)
Add the given field (item,value) to the form submitted by the next Upload. This can be used to send information to the server about the file or files being uploaded. See UploadToURL below. 1.48
UploadToURL(
BSTR url,
BSTR filename,
BSTR field) => bool
Please read Uploading before using this method.
Upload the contents (all images) of the control to the script specified by url. Use HTTP-POST, and pretend that the data is a file of the specified name. The transferred file is formatted based on the filename extension: .jpg, .gif, .tif, .pdf, etc. This method simulates the action of a user submitting a form whose ACTION=url, containing a file-upload field. See .
1.46
1.49+

UploadSeparatelyToURL(
url,filename,field
) => bool

Please read Uploading before using this method.
Upload all images in the control as separate file-items to the script specified by url. The extension on the filename determines the file format: .jpg, .pdf, .gif, .bmp, .tif. The number of each image is added to the filename and field: For example, if you specify filename="page.jpg" and field="file", the images are uploaded as "page1.jpg", "page2.jpg", etc., with field names "file1", "file2", etc.
This method simulates the action of a user submitting a form whose ACTION=url and METHOD="POST", containing one file-upload field for each image in the control. EZTwainX 1.49 adds support for secure uploads using SSL/HTTPS. See Uploading.
1.47
1.49
ViewLogFile Display the EZTwainX logfile using Notepad. 1.46b3
ZoomAroundPoint(x,y,z) Set the ZoomFactor to z and bring image pixel (x,y) to the center of the control. 1.64
ZoomToRectangle(x,y,w,h) Scroll and zoom so that the specified image rectangle fills the control. 1.64