Skip to content
GBG Documents & Biometrics Documentation

Slib.dll functions (C and C++)

The Slib library is used to scan documents and save their image into external bitmap files and to the internal image buffer. The library also saves the scanned image to an external bitmap file. The library sets and retrieves the scanners properties (such as scanning size, resolution, and color scheme). The library also encapsulates the magnetic reader functionality API.

Returns the USB port number to which the SnapShell camera is connected. Use a loop to call this function to release each SnapShell device or use the KillSnapServer function to release all the SnapShell devices at once.

Syntax

int AssignScanner (int scannerIndex)

Parameters

Parameter Description
[in] - Use -1 to release all SnapShell cameras

Calibrates the scanner using the calibration card

Syntax

short Calibrate ()

Return Values

Value Description
LICENSE_INVALID Library was not initialized with the proper license
SLIB_ERR_SCANNER_NOT_FOUND No attached scanner found
SLIB_ERR_INVALID_SCANNER Attached scanner is invalid
SLIB_FALSE Operation failed (no calibration card was found)
SLIB_TRUE Operation succeeded

The calibration creates and places the following calibration files:

Scanner File path File name(s)
ScanShell 800 C:/Documents and Settings/All Users/ Application Data/Card Scanning Solutions/ScanShell800 PixOffG6.dat, PixOff6.dat, PixGanG6.dat, PixGan6.dat, trvlusb.ini
ScanShell800N C:/Documents and Settings/All Users/ Application Data/Card Scanning Solutions/ScanShell800N PixOffG6.dat, PixOff6.dat, PixGanG6.dat, PixGan6.dat, trvlusb.ini
ScanShell800R C:/Documents and Settings/All Users/ Application Data/Card Scanning Solutions/ScanShell800R Calibration.dat
ScanShell800DX C:/Documents and Settings/All Users/ Application Data/Card Scanning Solutions/ScanShell800DX Calibration.dat
ScanShell800DXN C:/Documents and Settings/All Users/ Application Data/Card Scanning Solutions/ScanShell800DXN Calibration.dat
ScanShell800NR C:/Documents and Settings/All Users/ Application Data/Card Scanning Solutions/ScanShell800NR Calibration.dat
ScanShell2000R C:/Documents and Settings/All Users/ Application Data/Card Scanning Solutions/ScanShell2000R Calibration.dat
ScanShell2000NR C:/Documents and Settings/All Users/ Application Data/Card Scanning Solutions/ScanShell2000NR Calibration.dat
ScanShell1000 C:/WINDOWS/twain_32/SS1000 PixGan6.dat, PixGanF6.dat, PixGanG6.dat, PixOff6.dat, PixOffF6.dat, PixOffG6.dat, PxGanGF6.dat, PxOffGF6.dat, trvlusb.ini
ScanShell1000N C:/syscan/scanner/A5_FS531 PixGan6.dat, PixGanF6.dat, PixGanG6.dat, PixOff6.dat, PixOffF6.dat, PixOffG6.dat, PxGanGF6.dat, PxOffGF6.dat, trvlusb.ini
ScanShell1000A C:/syscan/scanner/ScanShell1000 PixGan6.dat, PixGanF6.dat, PixGanG6.dat, PixOff6.dat, PixOffF6.dat, PixOffG6.dat, PxGanGF6.dat, PxOffGF6.dat, trvlusb.ini
ScanShell1000A C:/syscan/scanner CSSN1000.INI
ScanShell1000NA C:/syscan/scanner/SS1000N PixGan6.dat, PixGanF6.dat, PixGanG6.dat, PixOff6.dat, PixOffF6.dat, PixOffG6.dat, PxGanGF6.dat, PxOffGF6.dat, trvlusb.ini
ScanShell1000NA C:/syscan/scanner SS1000N.ini
ScanShell3000D C:/Documents and Settings/All Users/ Application Data/Card Scanning Solutions/ScanShell3000D Calibration.dat
ScanShell3000DN C:/Documents and Settings/All Users/ Application Data/Card Scanning Solutions/ScanShell3000DN Calibration.dat
ScanShell3100D C:/Documents and Settings/All Users/ Application Data/Card Scanning Solutions/ScanShell3100D Calibration.dat
ScanShell3100DN C:/Documents and Settings/All Users/ Application Data/Card Scanning Solutions/ScanShell3100DN Calibration.dat

Note: ScanShell 800, ScanShell 800N and ScanShell 1000 scanners write the calibration files on a directory that might have security restrictions in NTFS drives. This may prevent users with insufficient security level from calibrating the scanner, which results in calibration failure. To remove the security from this location, run the program ResetSec.exe once while you are logged in with Administrator privileges.

See Also

NeedCalibration ()

Calibrates the scanner using the calibration card but it displays the calibration progress bar dialog.

Syntax

short CalibrateEx ()

Return Values

Value Description
LICENSE_INVALID Library was not initialized with the proper license
SLIB_ERR_SCANNER_NOT_FOUND No attached scanner found
SLIB_ERR_INVALID_SCANNER Attached scanner is invalid
SLIB_FALSE Operation failed (no calibration card was found)
SLIB_TRUE Operation succeeded

Cleans the scanner lens by running the cleaning pad (supplied in the scanner kit) back and forth. Applies to ScanShell 800 and ScanShell 800N models only.

Syntax

short CleanScanner ()

Return Values

Value Description
LICENSE_INVALID Library was not initialized with the proper license
SLIB_ERR_SCANNER_NOT_FOUND No attached scanner found
SLIB_ERR_INVALID_SCANNER Attached scanner is invalid
SLIB_FALSE Operation failed (no calibration card found)
SLIB_TRUE Operation succeeded

Returns the calibration threshold value

Syntax

short GetCalThreshold ()

Parameters

Parameter Description
[in] val Value to affect the ‘is need’ calibration function, where 1 = most sensitive and 100 = least sensitive. DEFAULT = 60

Returns the Duplex value

Syntax

short GetDuplex ()

Parameters

Parameter Description
[in] val 1 (True) or 0 (False)

Return Values

Returns the duplex value (1 or 0)

Returns the InOutScan value

Syntax

short GetInOutScan ()

Parameters

Parameter Description
[in] val 1 (True) or 0 (False)

Return Values

Returns the InOutScan value (1 or 0)

See Also

SetInOutScan (short bVal)

Returns the Slib version

Syntax

short ()

Parameters

Parameter Description
[in] version Null terminated string that contains the Slib version

Returns the current application name that initialized the SDK using the InitScanLibEx function

Syntax

short GetOwnerData (char *data)

Parameters

Parameter Description
[in] data Null terminated string that holds the owner application name

Returns the number of the button that was pressed on the scanner

Syntax

short GetPressedButton ()

Indicates the current scan progress. Applies only to ScanShell 800 and ScanShell 800N models.

Syntax

short GetProgress ()

Return Values

Returns a value from 0 – 100 that describes the current scan progress

Retrieves the current color scheme. Applies to ScanShell 800 and ScanShell 800N models only.

Syntax

short GetScannerColor ()

Return Values

Returns the color scheme of the current scanner (BW, GRAY, or TRUECOLOR)

See Also

SetScannerColor ()

Retrieves the resolution setting

Syntax

short GetScannerResolution()

Return Values

Returns the scanner’s resolution setting

See Also

SetScannerResolution()

Retrieves the scanner size in milli inch units

Syntax

GetScannerSize (short * pWidth, short * pHeight)

Return Values

Value Description
LICENSE_INVALID Library was not initialized with the proper license
SLIB_ERR_SCANNER_NOT_FOUND No attached scanner found
SLIB_ERR_BAD_WIDTH_PARAM pWidth value is NULL
SLIB_ERR_BAD_HEIGHT_PARAM pHeight value is NULL
SLIB_ERR_NONE Function successful

See Also

SetScannerSize ()

Retrieves the attached scanner type

Syntax

short GetScannerType ()

Return Values

Value Description
CSSN_NONE No attached scanner was found
CSSN_600 ScanShell 600 attached to PC
CSSN_800 ScanShell 800 attached to PC
CSSN_800N ScanShell 800N attached to PC
CSSN_1000 ScanShell 1000 attached to PC
CSSN_2000 ScanShell 2000 attached to PC
CSSN_2000N ScanShell 2000N attached to PC
CSSN_800E ScanShell 800E attached to PC
CSSN_800EN ScanShell 800EN attached to PC
CSSN_3000 ScanShell 3000 attached to PC
CSSN_4000 ScanShell 4000 attached to PC
CSSN_800G ScanShell 800G attached to PC
CSSN_5000 ScanShell 5000 attached to PC
CSSN_IDR SnapShell attached to PC
CSSN_800DX ScanShell 800DX attached to PC
CSSN_800DXN ScanShell 800DXN attached to PC
CSSN_FDA SnapShell attached to PC
CSSN_WMD SnapShell attached to PC
CSSN_TWN SnapShell attached to PC

Loads the scanner driver and initializes the internal image structure of the scanner library

Note: This function must be called before calling any other function in the library.

Syntax

short InitScanLib
(const char * szLicense)

Parameters

Parameter Description
[in] szLicense Null terminated string that holds the license key value

Return Values

Value Description
LICENSE_VALID License is valid and the library is ready to be used
LICENSE_INVALID License is invalid and all scanner operations are disabled
LICENSE_EXPIRED No attached scanner found
SLIB_ERR_DRIVER_NOT_FOUND Scanner driver not found and all scanner operations disabled; reinstall the scanner driver
SLIB_ERR_ SCANNER_NOT_FOUND Scanner not connected to the PC; all scanner operations disabled. Note: Make sure the scanner is connected and then restart the function.

Initializes the scanner library. 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. This function allows you to develop more than one application using the SDK and to control each of the application uses of the SDK. Only one application can use the SDK at a time.

Syntax

short InitScanLibEx (const char *lpszlicanse, int ownerId, const char* lpszOwnerName))

Parameters

Parameter Description
[in] szLicense Null terminated string that contains the license key value
[in] OwnerID An ID to the parent application
[in] OwnerName Name of the parent application

Return Values

Value Description
LICENSE_VALID License is valid and the library is ready to be used
LICENSE_INVALID License is invalid but all scanner operations are disabled
LICENSE_EXPIRED License has expired and all scanner operations are disabled
SLIB_ERR_DRIVER_NOT_FOUND Scanner driver not found; all scanner operations disabled. Note: Reinstall the scanner driver.
SLIB_ERR_SCANNER_NOT_FOUND Scanner not connected to the PC. Note: Make sure the scanner is connected and restart the function.
SLIB_LIBRARY_ALREADY_INITIALIZED Library already initialized by another application

Accesses the document sensor on the scanner and returns if a document was detected. In ScanShell 1000, this function returns if one of the silver buttons on the scanner was pressed.

Syntax

short IsPaperOn ()

Return Values

Value Description
SLIB_FALSE No document detected in scanner tray
SLIB_TRUE Document is in tray

Accesses the scanner to verify its connectivity to the PC. This should be tested before every scan. Non-calibrated scanners may generate images with incorrect colors.

Syntax

short IsScannerValid
()

Return Values

Value Description
SLIB_FALSE Scanner attached to the PC and resends correctly
SLIB_TRUE No scanner attached to the PC

See Also

Calibrate()

Determines if the scanner needs to be calibrated. This should be tested before every scan. Non-calibrated scanners may generate images with incorrect colors.

Syntax

short NeedCalibration
()

Return Values

Value Description
SLIB_FALSE No document detected in scanner tray
SLIB_TRUE Document is in tray

Deletes the internal image buffer

Syntax

short ResetImage ()

Scans document to the internal image buffer and, at the same time, exports it to a bitmap file on the local disk. Image should be scanned in true color and at 300 DPI format for proper OCR recognition.

Syntax

short ScanBmpFile (const char * szFileName)

Parameters

Parameter Description
[in] szLicense Null terminated string that holds the destination bitmap file name

Return Values

If the function succeeds, the return value is SLIB_ERR_NONE. If the function fails, the return number may be one of the following:

Value Description
SLIB_ERR_NONE Function is successful
LICENSE_INVALID Library not initialized with the proper license
SLIB_ERR_SCANNER_NOT_FOUND No attached scanner found
SLIB_ERR_SCANNER_GENERAL_FAIL Scanner failed to start
SLIB_ERR_HARDWARE_ERROR Scanner hardware error
SLIB_ERR_PAPER_FED_ERROR Document was not fed far enough in the 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

Scans document to the internal image buffer and displays a modal progress bar while the scan is in progress

Syntax

short ScanBmpFileEx (const char * szFileName)

Return Values

If the function succeeds, the return value is SLIB_ERR_NONE. If the function fails, it returns one of the following:

Value Description
SLIB_ERR_NONE Function is successful
LICENSE_INVALID Library not initialized with the proper license
SLIB_ERR_SCANNER_NOT_FOUND No attached scanner found
SLIB_ERR_SCANNER_GENERAL_FAIL Scanner failed to start
SLIB_ERR_HARDWARE_ERROR Scanner hardware error
SLIB_ERR_PAPER_FED_ERROR Document was not fed far enough in the 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

See Also

ScanBmpFile()

Sets the calibration threshold

Syntax

short SetCalThreshold (int val)

Parameters

Parameter Description
[in] val Value to affect the ‘is need’ calibration function, where*:* 100 = very clear image and 0 = image not clear. DEFAULT = 60

Can be called from a separate thread to abort ongoing scanning. After this function is called with the parameter 0, the ScanBmpFile function returns SLIB_ERR_CANCELED_BY_USER.

Syntax

short SetContinueScan (short continueCondition)

Parameters

Parameter Description
[in] continueCondition Value of 0 stops the scan progress immediately

Return Values

Value Description
SLIB_ERR_SCANNER_NOT_FOUND No attached scanner found
SLIB_ERR_NONE Function is successful

See Also

ScanBmpFile ()

Setting this value to True enables duplex (double-sided) scanning when using scanner models ScanShell 3000D/ScanShell 800DX/ ScanShell 800DXN.

Syntax

short SetDuplex(short bVal)

Parameters

Parameter Description
[in] val 1 (True) or 0 (False)

Setting this value causes the ScanShell 3000D/ ScanShell 800DX/ ScanShell 800DXN to eject the scanned document in an opposite direction to the scan feed direction. This option is used to scan documents that cannot be scanned in a feed-through manner such as passports.

Syntax

short SetInOutScan(short bVal)

Parameters

Parameter Description
[in] val 1 (True) or 0 (False)

See Also

GetInOutScan ()

Determines the color scheme of the scan result bitmap file

Syntax

short SetScannerColor (short color)

Parameters

Parameter Description
[in] color Color scheme of the scanned image:
[in] color

Return Values

Value Description
LICENSE_INVALID Library not initialized with the proper license
SLIB_ERR_SCANNER_NOT_FOUND No attached scanner found
SLIB_ERR_BAD_PARAM Bad parameter value
SLIB_ERR_NONE Function successful

See Also

GetScannerColor ()

Sets the scanner resolution settings. Resolution value can be any integer in the range 50-600 (DPI). The resolution value is rounded to the upper value of the nearest 100s boundary. For example, if the input value is 201, it is rounded up by the function to 300. Any value set outside this range is rejected and the previous value is used. The scanner’s default resolution is 300 DPI.

Syntax

short SetScannerResolution (short resolution)

Parameters

Parameter Description
[in] resolution Value of the required image resolution

Return Values

If the function succeeds, the return value is SLIB_ERR_NONE. If the function fails, the return number may be one of the following:

Value Description
SLIB_ERR_NONE Function is successful
LICENSE_INVALID Library not initialized with the proper license
SLIB_ERR_SCANNER_NOT_FOUND No attached scanner found
SLIB_ERR_SCANNER_GENERAL_FAIL Scanner failed to start
SLIB_ERR_CANCELED_BY_USER SetContinueScan function activated to cancel the scan
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 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

See Also

GetScannerResolution ()

Sets the size of a document’s scan boundaries. A document image beyond these boundaries will not reflect in the image file. If set to -1 for both values, the scanner will work in auto scan size (this is supported with regular scanners only).

Syntax

short SetScannerSize (short width, short height)

Parameters

Parameter Description
[in] width Document width (scanner’s default width is 220, which equates to 2.2”
[in] height Document height (scanner’s default width is 360, which equates to 3.6”

Return Values

Value Description
SLIB_ERR_NONE Function is successful
LICENSE_INVALID Library not initialized with the proper license
SLIB_ERR_SCANNER_ NOT_FOUND No attached scanner found

See Also

GetScannerSize ( )

Initializes the scanner type that has been set in this value first. Setting this value will set the SDK to load faster because the SLib will try to initialize the scanner type that has been set in this value first.

Syntax

void SetStartModel (int val)

Parameters

[in] val Scanner type
0 None
1 ScanShell 600
2 ScanShell 800
3 ScanShell 800N
4 ScanShell 1000
5 ScanShell 2000
6 ScanShell 2000N
7 ScanShell 800E
8 ScanShell 800EN
9 ScanShell 3000D
10 ScanShell 4000
11 ScanShell 800G
12 ScanShell 5000
13 SnapShell (IDR)
14 ScanShell 800DX
15 ScanShell 800DXN
16 SnapShell (FDA)
17 SnapShell (WMD)
18 SnapShell (TWN)
19 CSSN_PASS
20 CSSN_RTE8K
21 CSSN_TWAIN_N
22 CSSN_MAGTEK_STX
23 CSSN_CLBS

Returns the total number of connected SnapShell cameras

Syntax

int TotalConnecetedScanners ()

Setting this value sets the SDK to work only with the given scanner type.

Syntax

void UseFixedModel (int val)

Parameters

[in] val Scanner type [in] val Scanner type
0 None 12 ScanShell 5000
1 ScanShell 600 13 SnapShell (IDR)
2 ScanShell 800 14 ScanShell 800DX
3 ScanShell 800N 15 ScanShell 800DXN
4 ScanShell 1000 16 SnapShell (FDA)
5 ScanShell 2000 17 SnapShell (WMD)
6 ScanShell 2000N 18 SnapShell (TWN)
7 ScanShell 800E 19 CSSN_PASS
8 ScanShell 800EN 20 CSSN_RTE8K
9 ScanShell 3000D 21 CSSN_TWAIN_N
10 ScanShell 4000 22 CSSN_MAGTEK_STX
11 ScanShell 800G 23 CSSN_CLBS

Unloads the scanner driver from the memory (reversing the operation of the InitScanLib function) before initializing the SDK from the other application. The scanner library (and all other SDK libraries) can serve a single application at a time. If you wish to run another application (that uses the SDK), you must first unload the SDK from the memory using this function. If you fail to do so, you might run into a situation that both applications will attempt to access the scanner (and other SDK resources), resulting in degraded performance.

Syntax

short UnInitScanLib ()

Return Values

Value Description
SLIB_ERR_NONE Function is successful
SLIB_UNLOAD_FAILED_BAD_PARENT Cannot unload the driver (another application is using or has loaded it)
SLIB_ NOT_INITIALIZED Driver not found in memory (cannot be unloaded)

Unloads the scanner driver from the memory. The scanner library (and all other SDK libraries) can serve a single application at a time. If you wish to run another application (that uses the SDK), you must first unload the SDK from the memory using this function. If you fail to do so, you might run into a situation that both applications will attempt to access the scanner (and other SDK resources) – an operation that might hang the application. Use this function to unload the scanner driver from the memory (hence, to reverse the operation of the function InitScanLibEx) before initializing the SDK from the other application.

Syntax

short UnInitScanLibEx (int ownerId)

Parameters

Parameter Description
[in] OwnerID An ID to the parent application

Return Values

Value Description
SLIB_ERR_NONE Library unloaded successfully
SLIB_UNLOAD_FAILED_BAD_PARENT Cannot unload the driver (another application is either using it or has loaded it)
SLIB_ NOT_INITIALIZED Driver not found in memory (cannot be unloaded)

Stops and closes the SnapServer service that is used by the SnapShell camera. Call this function only after all the commands are done to close the application. This is the last function you should call when closing the application.

Syntax

short UnloadSnapServer ()