SlibEx library functions
InitLibrary
Section titled “InitLibrary”Use this function to initialize the scanner library. This function loads the scanner driver and initializes the internal image structure. This function must be called before calling any other function in the library.
Syntax
InitLibrary(License As String) As LongParameters
| Parameter | Description |
|---|---|
| [in] License | Null-terminated string that contains license key value |
Return Values
| Value | Description |
|---|---|
| SLIB_ERR_SCANNER_BUSY | Scanner busy executing the previous scanner command |
| LICENSE_VALID | License valid; library ready for use |
| LICENSE_INVALID | License invalid; all scanner operations disabled |
| LICENSE_EXPIRED | License expired; all scanner operations disabled |
| SLIB_ERR_DRIVER_NOT_FOUND | Scanner driver not found; all scanner operations disabled. Reinstall the scanner’s driver |
| SLIB_ERR_SCANNER_NOT_FOUND | Scanner not connected; all scanner operations disabled. Check the scanner connection. Restart the function |
Important: When the application unloads, it should call the UnInit function to unload the SDK and release its memory. (See the function description in ScanWex.pdf.)
CalibrateScanner
Section titled “CalibrateScanner”This function calibrates the scanner using the calibration card. The calibration results are stored in a file inside the windows directory. The operation result can be tested for good completion by reading the LastErrorStatus property. This property may store one of the following values:
Syntax
CalibrateScanner()Return Values
| Value | Description |
|---|---|
| SLIB_ERR_SCANNER_BUSY | Scanner busy executing the previous scanner command |
| LICENSE_INVALID | License invalid; all scanner operations disabled |
| SLIB_ERR_SCANNER_NOT_FOUND | Scanner not connected to PC; all scanner operations disabled. Check the scanner connection. Restart the function |
| SLIB_ERR_INVALID_SCANNER | Attached scanner invalid |
| SLIB_FALSE | Operation failed; no calibration card found |
| SLIB_TRUE | Operation succeeded |
CalibrateScanner
Section titled “CalibrateScanner”This function calibrates the scanner using the calibration card. The calibration results are stored in a file inside the windows directory. The operation result can be tested for good completion by reading the LastErrorStatus property.
Syntax
CalibrateScanner()This property may store one of the following values:
| Value | Description |
|---|---|
| SLIB_ERR_SCANNER_BUSY | Scanner busy executing the previous scanner command |
| LICENSE_INVALID | License invalid; all scanner operations disabled |
| SLIB_ERR_SCANNER_NOT_FOUND | Scanner not connected to PC; all scanner operations disabled. Check the scanner connection. Restart the function |
| SLIB_ERR_INVALID_SCANNER | Attached scanner invalid |
| SLIB_FALSE | Operation failed; no calibration card found |
| SLIB_TRUE | Operation succeeded |
Return Values
Void
Cleans the scanner lens by running the cleaning pad (supplied with the scanner kit) back and forth. This function applies only to scanner modules ScanShell 800/N.
Syntax
Clean()Return Values
| Value | Description |
|---|---|
| SLIB_ERR_SCANNER_BUSY | Scanner busy executing the previous scanner command |
ScanToFile
Section titled “ScanToFile”Scan a document to the internal image buffer and, at the same time, export it to a bitmap file named “File Name” in the local disk. The operation result can be tested for good completion by reading the LastErrorStatus property.
Note: You must scan the image in true color and at 300 dpi for OCR recognition.
After the scan, the internal image can be further manipulated and exported using separate commands:
| Command | Description |
|---|---|
| RotateImage | Rotate the internal image by 90, 180 or 270 degrees and/or modify the internal image resolution |
| ReformatImage | Modify the internal image color to gray or black and white images |
| ConvertImage | Save the internal image to an external file in one of the seven file formats |
Syntax
ScanToFile(FileName As String) As LongParameters
| Parameter | Description |
|---|---|
| [in] FileName | Null-terminated string that contains the full path of the scanned image |
Return Values
| Value | Description |
|---|---|
| SLIB_ERR_NONE | Function succeeded |
| SLIB_ERR_SCANNER_BUSY | Scanner busy executing the previous scanner command |
| SLIB_ERR_SCANNER_NOT_FOUND | Scanner not connected to PC; all scanner operations disabled. Check the scanner connection. Restart the function |
| SLIB_ERR_SCANNER_GENERAL_FAIL | Scanner failed to start |
| SLIB_ERR_HARDWARE_ERROR | Scanner hardware error |
| SLIB_ERR_PAPER_FED_ERROR | Document not fed far enough in tray to create image file |
| SLIB_ERR_SCANABORT | Scanning was aborted |
| SLIB_ERR_NO_PAPER | Paper jammed while scanner was running |
| SLIB_ERR_PAPER_JAM | Failed to create image file on disk |
| SLIB_ERR_FILE_IO_ERROR | Not applicable |
| SLIB_ERR_PRINTER_PORT_USED | Not enough memory to create temporary image |
| SLIB_ERR_OUT_OF_MEMORY | Paper jammed while scanner was running |
ScanToFileEx
Section titled “ScanToFileEx”This function is the same as ScanToFile, except that this function displays a progress bar that shows the scanning progress.
Syntax
ScanToFileEx(FileName As String) As LongParameters
| Parameter | Description |
|---|---|
| [in] FileName | Null-terminated string that contains the full path of the scanned image |
Return Values
| Value | Description |
|---|---|
| SLIB_ERR_NONE | Function succeeded |
| SLIB_ERR_SCANNER_BUSY | The scanner is still busy executing the previous scanner command. |
| SLIB_ERR_SCANNER_NOT_FOUND | Scanner not connected to PC; all scanner operations disabled. Check the scanner connection. Restart the function |
| SLIB_ERR_SCANNER_GENERAL_FAIL | Scanner failed to start |
| SLIB_ERR_HARDWARE_ERROR | Scanner hardware error |
| SLIB_ERR_PAPER_FED_ERROR | Document not fed far enough in tray to create an image file |
| SLIB_ERR_SCANABORT | Scanning was aborted |
| SLIB_ERR_NO_PAPER | No paper in tray |
| SLIB_ERR_PAPER_JAM | Paper jammed while scanner was running |
| SLIB_ERR_FILE_IO_ERROR | Failed to create image file on disk |
| SLIB_ERR_PRINTER_PORT_USED | Not applicable |
| SLIB_ERR_OUT_OF_MEMORY | Not enough memory to create temporary image |
ResetIntImage
Section titled “ResetIntImage”Deletes the internal image buffer
Syntax
ResetIntImage()