LsApi PDF
LsApi PDF
SERVICE INTERFACE
By
C.T.S. Electronics S.p.A.
Corso Vercelli 332
10015 IVREA (TO)
tel. ++390125235611
fax. ++390125235623
web site: www.ctsgroup.it
e-mail: [email protected]
1. Overview......................................................................................................................................5
2. Interface Functions Description...................................................................................................6
3. LsApi.ini Description...................................................................................................................7
4. Basic functions...........................................................................................................................14
4.1. LSConnect..........................................................................................................................15
4.2. LSConnectWithNetworkName..........................................................................................17
4.3. LSConnectWithIPAddress.................................................................................................18
4.4. LSDisconnect.....................................................................................................................19
4.5. LSSetNetworkName...........................................................................................................20
4.6. LSSetIPAddress..................................................................................................................21
4.7. LSGetVersion.....................................................................................................................22
4.8. LSUnitConfiguration..........................................................................................................23
4.9. LSUnitReserve...................................................................................................................26
4.10. LSUnitRelease................................................................................................................27
4.11. LSDocHandle.................................................................................................................28
4.12. LSReadCodeline.............................................................................................................32
4.13. LSReadImage.................................................................................................................34
4.14. LSReadImageMH...........................................................................................................36
4.15. LSDocHandleAndReadImage........................................................................................38
4.16. LSSetThresholdClearBlack............................................................................................43
4.17. LSLoadString.................................................................................................................44
4.18. LSLoadStringWithCounterEx........................................................................................45
4.19. LSLoadMixedString.......................................................................................................47
4.20. LSLoadMultiStrings.......................................................................................................49
4.21. LSReset..........................................................................................................................51
4.22. LSConfigDoubleLeafingAndDocLength.......................................................................52
4.23. LSSetLightIntensity........................................................................................................54
4.24. LSSetUnitSpeed.............................................................................................................55
4.25. LSUnitStatus..................................................................................................................56
4.26. LSPeripheralStatus.........................................................................................................59
4.27. LSSetSorterCriteria........................................................................................................64
4.28. LSSetOpticalWindows...................................................................................................66
4.29. LSDisableWaitDocument...............................................................................................68
4.30. LSChangeStampPosition................................................................................................69
4.31. LSUnitHistory................................................................................................................70
5. Advanced document handling functions....................................................................................72
5.1. LSAutoDocHandle.............................................................................................................73
5.2. LSAutoDocHandleVB........................................................................................................79
5.3. LS800AutoDocHandle.......................................................................................................81
5.4. LS800AutoDocHandleVB..................................................................................................87
5.5. LS800AutoDocHandleWithAllCallback............................................................................90
5.6. LSGetDocData...................................................................................................................96
5.7. LSGetDocDataMH.............................................................................................................99
5.8. LSGetDocDataEx.............................................................................................................102
5.9. LSStopAutoDocHandle....................................................................................................105
6. Magnetic stripe reader functions..............................................................................................106
The API is independent from the physical connection technology, whether it be SCSI, RS232, USB or
Ethernet used to connect the check scanners to the host system.
The reader must have a background knowledge of Win32 environment architecture and programming
techniques.
The LsApi.dll library extract same library for support, this library are placed in the same folder as where
LsApi.dll is located, the folder can be also selected to by setting the following registry key,
HKEY_LOCAL_MACHINE\SOFTWARE\CTS Electronics\LsApiPath
With the complete folder path.
To build an application program written in “C”-Language that makes use of these interface functions it is
necessary to include the file named LsApi.H and link LsApi.LIB library.
To start an application program that uses this service it is necessary to install in the application directory the
files listed below :
LsApi.DLL
LsApi.DLL
LsApi.H
LsApi.LIB
IMG_UTIL.DLL
LFBMP13N.DLL
LFCMP13N.DLL
LFFAX13N.DLL
LTDIS13N.DLL
LTDLG13N.DLL
LTFIL13N.DLL
LTIMG13N.DLL
LTKRN13N.DLL
LTEFX13N.DLL
CtsDecod.DLL
MicrDecodelib.DLL
CtsPdf.DLL (optional)
BarDecode.DLL (optional)
CtsDataMatrix.DLL (optional)
CtsQRCode.DLL (optional)
CtsTopImage.DLL (optional)
CtsClearPIX.DLL (optional)
CtsImagePro.DLL (optional)
CtsPdfDriverLicense.DLL (optional)
CtsIQA.DLL (optional)
CtsMetrix.DLL (optional)
CtsBarcodeLocate.DLL (optional)
CtsRS.DLL (optional)
With the Ethernet connection the images are exchanged over the network with a SSL secure protocol.
This is true is the following libraries are present in the same folder as where LsApi.dll is located on the
computer side:
LIBEAY32.DLL
SSLEAY32.DLL
LIBSSL32.DLL
This libraries mentioned above are downloadable from the link www.openssl.org.
This file must be copied in the same folder where is installed LsApi.dll.
It’s composed of two different sections, one specific for the unit model, another specific for the single
functions (this parser must be implemented).
It’s not necessary that all section be present in the ini file, only the sections present will be handled.
Note that it is possible to activate emulations via LsApi.ini file. Only one emulation can be activated at the
same time.
Hereafter it’s explained the flow adopted to connect a LSConnect :
If an empty entry of [IPBOX] in the ini file will always try to connect to the default IP Address 172.16.1.109.
;------------------------------------------------------------------------------
; [Global] - Section to configure global parameters
;
; CheckCartridge= Enables or disables the automatic check on the cartridge level
; Legal values : TRUE, FALSE, POPUP.
; Default : FALSE
;
; ThresholdInkDropsCartridge = this parameter defines the number of spots to be used
; as a maximum for determining that the cartridge level
; is low.
; Advised: 112000000
;------------------------------------------------------------------------------
[Global]
CheckCartridge = true
ThresholdInkDropsCartridge = 106000000
;------------------------------------------------------------------------------
; [Logging] - Section to configure trace parameters
;
; Enable = Enable disable the logging
; Legal values : true or false
;
; BatchMode = Enable disable the batch logging
; Legal values : true or false
;
; LogDir = Logging Folder es. C:\Windows\Temp
; if missing then directory is CtsTrace of lsapi directory
;
; MaxSize = Max size file logging (per file in batch mode) in bytes. (min value accepted 1 Mb.)
;------------------------------------------------------------------------------
[Logging]
Enable = false
BatchMode = true
;------------------------------------------------------------------------------
; [CtsMetrix] - Section to configure a LS device monitoring.
;
; Enabled = TRUE monitoring enabled, FALSE monitoring disabled
;
; ModulesPath = Path of monitor library and program
;
; LogFontForMICR = Type of MICR monitored CMC7 or E13B (default)
;
;------------------------------------------------------------------------------
[CtsMetrix]
Enabled = false
ModulesPath = ".\CtsMetrix"
LogFontForMICR = CMC7
;------------------------------------------------------------------------------
; [LsSharing] - Section to configure a shared connection.
;
; PC_IPAddress = IP address of the PC with the LS unit
; Computer_Name = Network Computer Name
;
;------------------------------------------------------------------------------
[LsSharing]
PC_IPAddress = 172.16.1.197
;Computer_Name = PC_NAME
;------------------------------------------------------------------------------
; [LS40] - Section to configure the LS40 model
;
; Deskew= Enables or disables the automatic image deskew
; Legal values : TRUE, FALSE.
; Advised : TRUE
;
; Mocr = Enables or disables MICR+OCR
; Legal values : E13B, CMC7, FALSE
; Advised : E13B or CMC7 depending on the check type used in your market
;
; Ls40_as_Ls100 = If TRUE a LS40 connected works as a LS100
; Legal values : TRUE, FALSE.
;
; Ls40_USB_as_Ls40_IpBox = If TRUE a LS40IPBOX connected works as a LS40-USB
; Legal values : TRUE, FALSE.
;
; Ls40_Stamp = If this parameter is present it must be set to FRONT_STAMP to force the
; stamp when the LS40 is connected in LS100 emulation mode.
;
; Ls100_Model = String returned by the LSIdentify API when a LS40 is connected as LS100.
; The string is the version of the Firmware expected by the application.
;
; BitonalMethod = This parameter defines the default method to be used for the bitonal conversion.
; Legal values :
; 4 ALGORITHM_CTS (Threshold Dinamyc)
; 6 ALGORITHM_CTS_3 (Threshold Fixed)
; 7 ALGORITHM_TOP_IMAGE (Threshold Dinamyc)
;------------------------------------------------------------------------------
; [LS100] - Section to configure the LS100 model
;
; DoubleLeafingValue = It sets the default double leafing sensitivity for each document.
; Legal values: percentage from 1 to 100 from the default device setting.
; Advised : 40
;
; DoubleLeafingMinLength= minimum document length in millimeter that can be processed
;
; DoubleLeafingMaxLength= maximum document length in millimeter that can be processed
;
; Deskew= Enables or disables the automatic image deskew
; Legal values : TRUE, FALSE.
; Advised : TRUE
;
; Mocr = Enables or disables MICR+OCR
; Legal values : E13B, CMC7, FALSE
; Advised : E13B or CMC7 depending on the check type used in your market
;
; Ls100_USB_as_Ls100_IpBox= If TRUE a LS100IPBOX connected works as a LS100-USB
; Legal values : TRUE, FALSE.
;
; Ls100_IpBox_as_Ls100_Ip= If TRUE a LS100IPBOX connected works as a LS100IP
;------------------------------------------------------------------------------
; [LS150] - Section to configure the LS150 model
;
; DoubleLeafingValue = It sets the default double leafing sensitivity for each document.
; Legal values: percentage from 1 to 100 from the default device setting.
; Advised : 33
;
; DoubleLeafingMinLength= minimum document length in millimeter that can be processed
;
; DoubleLeafingMaxLength= maximum document length in millimeter that can be processed
;
; Deskew = Enables or disables the automatic image deskew
; Legal values : TRUE, FALSE.
; Advised : E13B or CMC7 depending on the check type used in your market
;
; Mocr = Enables or disables MICR+OCR
; Legal values : E13B, CMC7, FALSE
; Advised : E13B
;
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; [LS800] - Section to configure the LS800 model
;
; Deskew= Enables or disables the automatic image deskew
; Legal values : TRUE, FALSE.
; Advised : TRUE
;
; BitonalMethod = This parameter defines the default method to be used for the bitonal conversion.
; Legal values :
; 4 ALGORITHM_CTS (Threshold Dinamyc)
; 6 ALGORITHM_CTS_3 (Threshold Fixed)
; 7 ALGORITHM_TOP_IMAGE (Threshold Dinamyc)
; 8 ALGORITHM_IMAGE_PRO (Threshold Dinamyc)
; 9 ALGORITHM_CLEAR_PIX (Threshold Dinamyc)
; Advised : 4
;
; BitonalThreshold = This parameter defines the default threshold to be used for the bitonal conversion.
; Legal values :
;------------------------------------------------------------------------------
; [IPBox] - Section to configure a IPBox connection.
;
; IPBox_Address = IP address of the device (used only in emulation modes)
;
; BW_OnBaord = false the conversion will done on PC (more speed)
; = true the conversion will done on the LSConnect (less network traffic)
;
;------------------------------------------------------------------------------
[IpBox]
IPBox_NetworkName = ctslsconnect ; Network logical name
IPBox_Address = 172.16.1.190 ; The IP Address set on the LSConnect
BW_OnBoard = false
Some functions are also supported in such a way that the parameters are obtained from a configuration file
LsApi.ini that must be present in the same folder where LsApi.dll is located.
Please refer to the section 3 for the details of this configuration file.
Description
Open a connection between the application and the LS service.
The function returns a connection handle.
When the parameter LsUnit is set to LS_515_USB, the function before returning the reply
LS_PERIPHERAL_NOT_FOUND tries to connect also the LS520 unit.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hInst
Hinstance of the application window (Reserved for future use).
LsUnit
Specifies the device that must be connected, the accepted values are :
LS_40_LSCONNECT
LS_40_USB
LS_100_LSCONNECT
LS_100_USB
LS_100_ETH
LS_100_RS232
LS_150_LSCONNECT
LS_150_USB
LS_200_USB
LS_5xx_SCSI
LS_515_LSCONNECT
LS_515_USB
LS_520_USB
LS_800_USB
LS_UNIT_SHARED
hConnect
Connection handle returned by the service, this value shall be used in the most of the other
functions that talk to the device.
Return Value
LS_OKAY if successful
LS_TRY_TO_RESET if the peripheral is in error state otherwise standard reply code.
LS_PERIPHERAL_NOT_FOUND
Comments
This function call must be invoked to establish the communication link with the specific LS device.
Description
Open a connection between the application and the LS service.
The function returns a connection handle.
For use this function on the LSConnect MUST be installed the Samba service.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hInst
Hinstance of the application window (Reserved for future use).
LsUnit
Specifies the device that must be connected, the accepted values are :
LS_40_LSCONNECT
LS_100_LSCONNECT
LS_100_ETH
LS_150_LSCONNECT
LS_515_LSCONNECT
LS_UNIT_SHARED
IpBoxName
IP Adddress of the peripheral to connect.
NetPort
Port to connect (fix to 4000 for the moment).
hConnect
Connection handle returned by the service, this value shall be used in the most of the other
functions that talk to the device.
Return Value
LS_OKAY if successful
LS_TRY_TO_RESET if the peripheral is in error state otherwise standard reply code.
LS_PERIPHERAL_NOT_FOUND
Comments
This function is used to connect the Ethernet models without the need to call the LSSetIPAddress()
function.
Description
Open a connection between the application and the LS service.
The function returns a connection handle.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hInst
Hinstance of the application window (Reserved for future use).
LsUnit
Specifies the device that must be connected, the accepted values are :
LS_40_LSCONNECT
LS_100_LSCONNECT
LS_100_ETH
LS_150_LSCONNECT
LS_515_LSCONNECT
LS_UNIT_SHARED
IpAddress
IP Adddress of the peripheral to connect.
NetPort
Port to connect (fix to 4000 for the moment).
hConnect
Connection handle returned by the service, this value shall be used in the most of the other
functions that talk to the device.
Return Value
LS_OKAY if successful
LS_TRY_TO_RESET if the peripheral is in error state otherwise standard reply code.
LS_PERIPHERAL_NOT_FOUND
Comments
This function is used to connect the Ethernet models without the need to call the LSSetIPAddress()
function.
Description
Close a connection between a client application and LS service.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Return Value
LS_OKAY if successful, otherwise standard reply code
LS_PERIPHERAL_NOT_FOUND
Comments
Description
Set the network logical name of the LSConnect to connect.
For use this function on the LSConnect MUST be installed the Samba service.
Parameters
LsUnit
Specifies the device that must be connected, the accepted values are :
LS_40_LSCONNECT
LS_100_LSCONNECT
LS_100_ETH
LS_150_LSCONNECT
LS_515_LSCONNECT
LS_UNIT_SHARED
New_Eth_IpAddress
Network node logical name.
New_Net_Port
Port to connect (fix to 4000 at the moment).
Return Value
LS_OKAY
LS_PERIPHERAL_NOT_FOUND
Comments
Description
Set the IP Address of the LSConnect unit to connect.
Parameters
LsUnit
Specifies the device that must be connected, the accepted values are :
LS_40_LSCONNECT
LS_100_LSCONNECT
LS_100_ETH
LS_150_LSCONNECT
LS_515_LSCONNECT
LS_UNIT_SHARED
New_Eth_IpAddress
IP Adddress of the LSConnect unit to connect.
New_Net_Port
Port to connect (fix to 4000 at the moment).
Return Value
LS_OKAY
LS_PERIPHERAL_NOT_FOUND
Comments
Description
Return the version of the library.
Parameters
VersionLibrary
This string contains the release of the driver library. The length of this string is 64 bytes
maximum.
LengthStr
Length of the string returned in VersionLibrary.
Return Value
LS_OKAY if successful.
LS_STRING_TRUNCATED
Comments
Description
Returns specific information about hardware configuration and capabilities of the LS device
connected to the service.
The Size field of the struct UNITSTRUCTCONFIGURATION give as pointer must be compiled with
the size of function from the caller application.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
pReserved
Reserved, must be set to NULL.
DeviceFeatures
Pointer to a struct the return the features of the unit connected. The structure is described in
the comments section.
LsModel
Pointer to a string that will contain the peripheral model, 15 bytes long, maximum.
FW_Version
Pointer to a string that will contain the firmware revision of the peripheral, 10 bytes long,
maximum.
FW_Date
Pointer to a string that will contain the firmware date of the peripheral, 10 bytes long,
maximum.
PeripheralID
Pointer to a string that will contain the internal peripheral serial number, 12 bytes long,
maximum.
DecoderExpVersion
Pointer to a string that will contain the firmware revision of the decoder board expansion, 10
bytes long, maximum.
InkJetVersion
Pointer to a string that will contain the firmware revision of the inkjet board expansion, 10
bytes long, maximum.
FeederVersion
Pointer to a string that will contain the firmware revision of the feeder connected, 10 bytes
long maximum.
SorterVersion
Pointer to a string that will contain the firmware revision of the sorter/s connected, 10 bytes
long maximum, all the sorters connected must have the same firmware, otherwise this field
contain the character ?.
Parameter returned only in case of LS800 model.
MotorVersion
Pointer to a string that will contain the firmware revision of the motor, 10 bytes long
maximum.
Parameter returned only in case of LS800 model.
Reserved1
Reserved for future use, must be set to NULL.
Reserved2
Reserved for future use, must be set to NULL.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_RESERVED_ERROR
Comments
This function can be used only after a successful LSConnect command.
The application must compile the Size fileld with the size of the structure.
UNITCONFIGURATION.Size = sizeof(UNITCONFIGURATION );
} UNITCONFIGURATION, *PUNITCONFIGURATION;
Description
Reserve the device for the calling application.
This function must be called when an LS device, connected via USB to the PC, can be used from
more than one application.
This function can also be used when the device is shared among different PCs.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Timeout
Timeout value expressed in milliseconds, only with USB connections for –1 the function wait
indefinitely.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_INVALID_TIMEOUT
LS_PERIPHERAL_RESERVED
Comments
An application must call this function to reserve the device before issuing the following commands:
LSIdentify(), LSReset() or LSDocHandle() plus LSReadImage() or LSAutoDocHandle() plus
LSGetDocData() .
When those operations are finished, the application must call the LSUnitRelease() to allow another
application to use the device.
It is important that the application reserve the device before feeding the checks and releases it when
the boundle of checks is finished.
Description
The calling application release the peripheral when the current operation is finished.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_ILLEGAL_REQUEST
Comments
Description
The behavior of this command will be dependent on the model of LS device employed. It will set the
LS device in a waiting-for-document-introduction state, for models where documents are manually
fed one at a time. It will activate the automatic feeding from an input feeder, for models where
documents are processed in a bundle. After being drawn in the document is processed. The
document processing will be done according to the options specified in the input parameters. The
device will store in its internal memory the scanned images and MICR codeline of the last processed
document (when the relevant parameters in the command are set for document scanning and/or
MICR codeline reading). In order to retrieve the image(s) of the processed document the application
must use the LSReadImage command, and the LSReadCodeline command is likewise required to
retrieve the MICR codeline data.
Please also refer to the LSConfigDoubleLeafingAndDocLength() function to configure the
paper sensibility in the correct way to handle the double leafing functionality.
NOTE : LS100 model does NOT support the 300 dpi resolution.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Stamp
NO_FRONT_STAMP = do not stamp document
FRONT_STAMP = stamp front side of document
REAR_STAMP = stamp rear side of document
FRONT_AND_REAR_STAMP = stamp both front and rear sides of document (this option is
possible only with LS5xx models)
Validate
NO_PRINT_VALIDATE = do not print validation string
PRINT_VALIDATE = print validation string (the text of the validation string must be loaded
using the LSLoadString command before invoking this command). The LS
device must be equipped with the optional validation printer.
Codeline
NO_READ_CODELINE = do not read codeline.
READ_CODELINE_MICR = read magnetic codeline CMC7 or E13B. The LS device must be
equipped with a magnetic character reader.
READ_CODELINE_E13B_MICR_AND_OCR = read a codeline E13B in magnetic / optic
mode
READ_CODELINE_CMC7_MICR_AND_OCR = read a codeline CMC7 in magnetic / optic
mode
READ_CODELINE_MICRO_HOLES = read a MicroHoles codeline present on the
document. IMPORTANT if this define is set in order to obtain Micro
codelines, then the application must call the function LSReadImageMH()
instead of LSReadImage().
READ_CODELINE_MICR_AND_MICRO_HOLES = read a codeline CMC7 or E13B and the
MicroHoles codeline present on the document. IMPORTANT if this define is
set in order to obtain Micro codelines, then the application must call the
function LSReadImageMH() instead of LSReadImage().
READ_CODELINE_CMC7_MOCR_AND_MICRO_HOLES = read a codeline CMC7 in
magnetic / optic mode and the MicroHoles codeline present on the
document. IMPORTANT if this define is set in order to obtain Micro
codelines, then the application must call the function LSReadImageMH()
instead of LSReadImage().
The following values are applicable when the LS device is equipped with an optional barcode
reader or optical reader :
READ_BARCODE_HW = read a 2 of 5 barcode (LS510 model only)
Side
It specifies which side(s) of the document to scan
SIDE_FRONT_IMAGE = Scan Front side
SIDE_BACK_IMAGE = Scan Rear side
SIDE_ALL_IMAGE = Scan Both sides
SIDE_NONE_IMAGE = Do not scan document
ScanMode
This parameter sets the resolution applied when scanning the document. Accepted values
are :
SCAN_MODE_BW = black and white at 200 dpi
SCAN_MODE_16GR100 = 16 grey scale at 100 dpi
SCAN_MODE_16GR120 = 16 grey scale at 120 dpi
SCAN_MODE_16GR200 = 16 grey scale at 200 dpi
SCAN_MODE_16GR240 = 16 grey scale at 240 dpi
SCAN_MODE_16GR300 = 16 grey scale at 300 dpi
SCAN_MODE_256GR100 = 256 grey scale at 100 dpi
SCAN_MODE_256GR120 = 256 grey scale at 120 dpi
SCAN_MODE_256GR200 = 256 grey scale at 200 dpi
SCAN_MODE_256GR240 = 256 grey scale at 240 dpi
SCAN_MODE_256GR300 = 256 grey scale at 300 dpi
SCAN_MODE_256GR100_AND_UV = 256 gray scale at 100 dpi and Ultra Violet images
SCAN_MODE_256GR200_AND_UV = 256 gray scale at 200 dpi and Ultra Violet images
SCAN_MODE_256GR300_AND_UV = 256 gray scale at 300 dpi and Ultra Violet images
SCAN_MODE_COLOR_100 = Color 24 bit 100 dpi
SCAN_MODE_COLOR_200 = Color 24 bit 200 dpi
SCAN_MODE_COLOR_300 = Color 24 bit 300 dpi
SCAN_MODE_COLOR_100_AND_UV = 256 gray scale at 100 dpi and Ultra Violet images
SCAN_MODE_COLOR_200_AND_UV = 256 gray scale at 200 dpi and Ultra Violet images
SCAN_MODE_COLOR_300_AND_UV = 256 gray scale at 300 dpi and Ultra Violet images
Feeder
It specifies the source of the document
AUTO_FEED = document from feeder.
PATH_FEED = document from path. This value should be used when the document
processing requires two or more passes. It requires that in the previous
pass the value set for Sorter parameter is HOLD_DOCUMENT. Used also
for Linear Entry on LS5xx series.
Sorter
It specifies the destination of the processed document. The applicable values depend on the
model of LS device being used :
HOLD_DOCUMENT = hold document. In the next pass the parameter Feeder must take the
value PATH_FEED
SORTER_BAY1 = document is stacked in sorting pocket 1.
SORTER_BAY2 = document is stacked in sorting pocket 2
SORTER_AUTOMATIC = send the document to the destination set by a previous
LSSetSorterCriteria command (on LS510, LS515 models).
SORTER_SWITCH_1_TO_2 = documents are sorted in Pocket 1, until it becomes full at
which point sorting continues to Pocket 2. When Pocket 2 becomes full the
service will return a LS_SORTERS_BOTH_FULL error code.
EJECT_DOCUMENT = the document is returned to the input feeding slot. (LS40 and LS100
models)
WaitTimeout
This parameter sets the behavior of the device when there are no more documents to
process.
WAIT_YES = the device waits for approximately 7 seconds for a new document to process,
when this internal timer expires and there is not a new document to process
the command completes with return code LS_FEEDER_EMPTY .
WAIT_NO = if no document is present, or after the last document in the feeder has been
processed, the service will immediately complete with return code
LS_FEEDER_EMPTY.
Beep
Specifies whether the internal beeper should emit an acoustical sound when an error occurs.
Accepted values are :
NO_BEEP : do not activate beeper.
BEEP : activate beeper.
NrDoc
Required ONLY for LS100 Models otherwise can be set to NULL.
This is an output parameter that will be set when the command processing completes.
It returns the number of processed documents. The numbers in the range 1 to NrDoc must
be used as ID’s to point to a given document’s data when retrieving the scanned image(s)
(by means of LSReadImage).
ScanDocType
Reserved2
Reserved for future use, must be set to NULL.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_PAPER_JAM
LS_COMMAND_IN_EXECUTION_YET
LS_DOUBLE_LEAFING_ERROR
LS_DOUBLE_LEAFING_WARNING
LS_REPLACE_CARTRIDGE
Comments
Note :
If the application is requesting to read MicroHole codeline, the function will force the resolution at 300
dpi. The image returned, however, will be the one requested by the application.
Description
This function should be used to retrieve the codeline data read from a document previously
processed by LSDocHandle command. It applies only to LS device models equipped with the
relevant hardware (MICR reader, Barcode reader, OCR reader) for codeline reading (check LS
device capabilities).
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Codeline
Pointer to the user buffer where the magnetic codeline data will be transferred by the
service. This buffer will be filled also in case Magnetic and Optical is requested.
Length_Codeline
Pointer to a variable of input/output, in input it specifies the size of the buffer pointed by
Codeline parameter, in output it will return the actual length of the codeline data transferred
by the service.
Barcode
Pointer to the user buffer where the barcode codeline data will be transferred by the service.
Length_Barcode
Pointer to a variable of input/output, in input it specifies the size of the buffer pointed by
Barcode parameter, in output it will return the actual length of the codeline data transferred
by the service.
Optic
Pointer to the user buffer where the optical codeline data will be transferred by the service.
Length_Optic
Pointer to a variable of input/output, in input it specifies the size of the buffer pointed by
Optic parameter, in output it will return the actual length of the codeline data transferred by
the service.
Return Value
LS_OKAY
Comments
When the service returns more than one codeline there will be a NULL character as separator
between one codeline data and the next.
This function is not available on the LS800 model.
Description
This function should be used to retrieve the images of the front and/or back side of a document
previously processed and scanned by LSDocHandle command.
Parameters
hConnect
Handle returned by LSConnect.
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
ClearBlack
Specifies whether or not to apply the filter for cleaning the black area around the image(s).
NO_CLEAR_BLACK = no image cleaning, the black area is not removed.
CLEAR_ALL_BLACK = clean the document's image removing all the black around the
image according to the level of filter specified by
LSSetThresholdClearBlack command.
CLEAR_AND_ALIGN_IMAGE = removing all the black around the image and align the
document’s image. (deskew)
Side
Specifies which of the document’s scanned sides to return.
SIDE_FRONT_IMAGE = Front side image
SIDE_BACK_IMAGE = Rear side image
SIDE_ALL_IMAGE = Both Front and Rear side images
ReadMode
Fixed to READMODE_BRUTTO.
NrDoc
Required ONLY for LS100 models, otherwise can be set to 0.
This is a value that must be grater than zero and less than or equal to the NrDoc value
returned by LSDocHandle command. It specifies the sequence number for multiple
documents processed by LSDocHandle.
FrontImage
Pointer to a handle where will be returned the handle of memory buffer containing the front
side image of the requested document, in DIB format.
BackImage
FrontImage2
Pointer to a handle where will be returned the handle of memory buffer containing the Ultra
Violet front side image of the requested document, in DIB format.
BackImage2
Reserved for future improvement, must be set to NULL.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_OPEN_NOT_DONE
LS_COMMAND_SEQUENCE_ERROR
LS_INVALID_TYPE_COMMAND
LS_INVALID_CLEARBLACK
LS_INVALID_SIDE
Comments
The image handle retrieved by this function must be released by the application.
This function is not available on the LS800 model.
Description
This function should be used to retrieve the images of the front and/or back side of a document
previously processed and scanned by LSDocHandle() function, but return also the MicroHole
codelines, if the parameter Codeline is set to READ_CODELINE_MICR_AND_MICRO_HOLES or
READ_CODELINE_CMC7_MOCR_AND_MICRO_HOLES.
Parameters
hConnect
Handle returned by LSConnect.
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
ClearBlack
Specifies whether or not to apply the filter for cleaning the black area around the image(s).
NO_CLEAR_BLACK = no image cleaning, the black area is not removed.
CLEAR_ALL_BLACK = clean the document's image removing all the black around the
image according to the level of filter specified by
LSSetThresholdClearBlack command.
CLEAR_AND_ALIGN_IMAGE = removing all the black around the image and align the
document’s image. (deskew)
Side
Specifies which of the document’s scanned sides to return.
SIDE_FRONT_IMAGE = Front side image
SIDE_BACK_IMAGE = Rear side image
SIDE_ALL_IMAGE = Both Front and Rear side images
ReadMode
Fixed to READMODE_BRUTTO.
NrDoc
Required ONLY for LS100 models, otherwise can be set to 0.
This is a value that must be grater than zero and less than or equal to the NrDoc value
returned by LSDocHandle command. It specifies the sequence number for multiple
documents processed by LSDocHandle.
BackImage
Pointer to a handle where will be returned the handle of memory buffer containing the rear
side image of the requested document, in DIB format.
FrontImage2
Pointer to a handle where will be returned the handle of memory buffer containing the Ultra
Violet front side image of the requested document, in DIB format.
BackImage2
Reserved for future improvement, must be set to NULL.
VerifyHole
Specify if verification of micro perforation of the paper is required.
UnitMeasure
Specify whether the Start_X, Start_Y, SizeW and SizeH measures are expressed in
millimeters or in inches.
The possible values are either UNIT_MM or UNIT_INCH.
nrRegions
Number of codeline to decode.
stMicroHole
Array of structure with parameters per each region, described in Comments section of the
function LSReadMicroHolesCodelines().
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_OPEN_NOT_DONE
LS_COMMAND_SEQUENCE_ERROR
LS_INVALID_TYPE_COMMAND
LS_INVALID_CLEARBLACK
LS_INVALID_SIDE
Comments
The image handle retrieved by this function must be released by the application.
Description
This command MUST be called after a command of LSDocHandle, in place of a LSReadImage, but
after a LSReadCodeline, if the MICR codeline if required.
The behavior of this command it’s alike to do a LSReadImage with a LSDocHandle, but optimize
the performance of the device, because before to read the image of the previous handled document
it to start another one.
Remark, when the function return with a reply different from LS_OKAY, the application must call
one time the function LSReadImage for keep the images of the last document scanned.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Stamp
NO_FRONT_STAMP = do not stamp document
FRONT_STAMP = stamp front side of document
REAR_STAMP = stamp rear side of document
FRONT_AND_REAR_STAMP = stamp both front and rear sides of document (this option is
possible only with LS5xx models)
Validate
NO_PRINT_VALIDATE = do not print validation string
PRINT_VALIDATE = print validation string (the text of the validation string must be loaded
using the LSLoadString command before invoking this command). The LS
device must be equipped with the optional validation printer.
PRINT_DIGITAL_VALIDATE = print digital validation string (the text of the validation string
must be loaded using the LSLoadDigitalStringWithCounter command
before invoking this command).
The following values are applicable when the LS device is equipped with an optional barcode
reader or optical reader :
READ_BARCODE_HW = read a 2 of 5 barcode (LS510 model only)
Side
It specifies which side(s) of the document to scan
SIDE_FRONT_IMAGE = Scan Front side
SIDE_BACK_IMAGE = Scan Rear side
SIDE_ALL_IMAGE = Scan Both sides
SIDE_NONE_IMAGE = Do not scan document
ScanMode
This parameter sets the resolution applied when scanning the document. Accepted values
are :
SCAN_MODE_BW = black and white at 200 dpi
SCAN_MODE_16GR100 = 16 grey scale at 100 dpi
SCAN_MODE_16GR120 = 16 grey scale at 120 dpi
SCAN_MODE_16GR200 = 16 grey scale at 200 dpi
SCAN_MODE_16GR240 = 16 grey scale at 240 dpi
SCAN_MODE_16GR300 = 16 grey scale at 300 dpi (LS40, LS150 and LS520 model)
SCAN_MODE_256GR100BN = 256 gray scale at 100 dpi Brutto and Netto images (LS515
model only)
SCAN_MODE_256GR200BN = 256 gray scale at 200 dpi Brutto and Netto images (LS515
model only)
SCAN_MODE_256GR100 = 256 grey scale at 100 dpi
SCAN_MODE_256GR120 = 256 grey scale at 120 dpi
SCAN_MODE_256GR200 = 256 grey scale at 200 dpi
SCAN_MODE_256GR240 = 256 grey scale at 240 dpi
SCAN_MODE_256GR300 = 256 grey scale at 300 dpi (LS40, LS150 and LS520 model)
SCAN_MODE_256GR100_AND_UV = 256 gray scale at 100 dpi and Ultra Violet images
(LS150 model)
SCAN_MODE_256GR200_AND_UV = 256 gray scale at 200 dpi and Ultra Violet images
(LS150 model)
SCAN_MODE_COLOR_100 = Color 24 bit 100 dpi
SCAN_MODE_COLOR_200 = Color 24 bit 200 dpi
SCAN_MODE_COLOR_300 = Color 24 bit 300 dpi (LS150 and LS520 model)
SCAN_MODE_COLOR_AND_RED_100 = Color 24 bit at 100 dpi and Netto images (LS100
and LS515 model)
SCAN_MODE_COLOR_AND_RED_200 = Color 24 bit at 200 dpi and Netto images (LS100
and LS515 model)
SCAN_MODE_256GR100_ONLY_RED = 256 gray scale at 100 dpi Red images
SCAN_MODE_256GR200_ONLY_RED = 256 gray scale at 200 dpi Red images
SCAN_MODE_256GR300_ONLY_RED = 256 gray scale at 300 dpi Red images
Feeder
It specifies the source of the document
AUTO_FEED = document from feeder.
PATH_FEED = document from path. This value should be used when the document
processing requires two or more passes. It requires that in the previous
pass the value set for Sorter parameter is HOLD_DOCUMENT. Used also
for Linear Entry on LS5xx series.
Sorter
WaitTimeout
This parameter sets the behavior of the device when there are no more documents to
process.
WAIT_YES = the device waits for approximately 7 seconds for a new document to process,
when this internal timer expires and there is not a new document to process
the command completes with return code LS_FEEDER_EMPTY .
WAIT_NO = if no document is present, or after the last document in the feeder has been
processed, the service will immediately complete with return code
LS_FEEDER_EMPTY.
Beep
Specifies whether the internal beeper should emit an acoustical sound when an error occurs.
Accepted values are :
NO_BEEP : do not activate beeper
BEEP : activate beeper
ScanDocType
Specifies the type of document to processed.
Accepted values are :
SCAN_PAPER_DOCUMENT : for paper
SCAN_CARD : for card
SCAN_LONG_DOCUMENT : for receipt, sales check
Reserved2
Reserved for future use, must be set to NULL.
ClearBlack
Specifies whether or not to apply the filter for cleaning the black area around the image(s).
NO_CLEAR_BLACK = no image cleaning, the black area is not removed.
CLEAR_ALL_BLACK = clean the document's image removing all the black around the
image according to the level of filter specified by
LSSetThresholdClearBlack command.
CLEAR_AND_ALIGN_IMAGE = removing all the black around the image and align the
document’s image. (deskew)
FrontImage
Pointer to a handle where will be returned the handle of memory buffer containing the front
side image of the requested document, in DIB format.
BackImage
Pointer to a handle where will be returned the handle of memory buffer containing the rear
side image of the requested document, in DIB format.
FrontImage2
Pointer to a handle where will be returned the handle of memory buffer containing the Ultra
Violet front side image of the requested document, in DIB format.
BackImage2
Reserved for future improvement, must be set to NULL.
Comments
A little piece of “C” code for illustrate the behavior of the function.
NrDoc = 0;
LSFreeImage(hDlg, &BufFrontImage);
LSFreeImage(hDlg, &BufBackImage);
}
}
// When you finish the while read the last image for reply Ok or not
Description
This function is used to set the desired threshold value for cleaning the black coloring that may result
around the scanned image of the document. This value will be used by the LSReadImage command
to apply the appropriate level of filter in cleaning the black area before returning the scanned image
to the application.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Threshold
Value of black used as threshold for cleaning the image, range 0 (black) to 255 (white), the
default value is DEFAULT_BLACK_THRESHOLD.
Return Value
LS_OKAY
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
Comments
Description
Loads the text of invalidation string, which may be printed onto the BACK side of the document with
the ink-jet printer.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Format
Set the character style for the invalidation string,
PRINT_FORMAT_NORMAL = Normal font, low position.
PRINT_FORMAT_BOLD = Bold font, low position.
PRINT_FORMAT_NORMAL_15_CHAR = Normal 15 char for Inch font, low position.
PRINT_UP_FORMAT_NORMAL = Normal font , high position. (LS100, LS150 models)
PRINT_UP_FORMAT_BOLD = Bold font , high position. (LS100, LS150 models)
PRINT_UP_FORMAT_NORMAL_15_CHAR = Normal 15 char for Inch font , high position.
(LS100, LS150 models)
Length
Length of the invalidation string
String
Invalidation string
Return Value
LS_OKAY
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_INVALID_FORMAT
Comments
Supported only by the peripheral LS models equipped with a backside invalidation printer.
Description
Loads the invalidation string, which may be printed onto the back side of the document with the ink-
jet printer.. It differs from LSLoadString in that it is possible to specify a starting number that will be
automatically incremented or decremented for each new document.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Format
Set the character style for the invalidation string,
PRINT_FORMAT_NORMAL = Normal font, low position.
PRINT_FORMAT_BOLD = Bold font, low position.
PRINT_FORMAT_NORMAL_15_CHAR = Normal 15 char for Inch font, low position.
PRINT_UP_FORMAT_NORMAL = Normal font , high position. (LS100, LS150 models)
PRINT_UP_FORMAT_BOLD = Bold font , high position. (LS100, LS150 models)
PRINT_UP_FORMAT_NORMAL_15_CHAR = Normal 15 char for Inch font , high position.
(LS100, LS150 models)
String
Invalidation string having the same syntax of the C-language PRINTF function.
Length
Length of the string give in the String parameter.
StartNumber
Starting number used in the invalidation print numeration.
Step
When greater than zero it sets the increment step applied to StartNumber .
When less than zero it sets the decrement step applied to StartNumber .
Return Value
LS_OKAY
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
LS_SYSTEM_ERROR
LS_USB_ERROR
Comments
Supported only by the peripheral LS models equipped with a backside invalidation printer.
Description
Loads the text of invalidation string, which may be printed onto the BACK side of the document with
the ink-jet printer. It different from LSLoadString() that is possible print a string with some word in
normal font mixed with some word in bold font.
Available only on LS150 model with Firmware 1.38 or higher.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Reserved1
Reserved for future use. Must be set to 0.
Reserved2
Reserved for future use. Must be set to 0.
Font1
Set the character style for the invalidation string,
PRINT_FORMAT_NORMAL = Normal font, low position.
PRINT_FORMAT_BOLD = Bold font, low position.
PRINT_UP_FORMAT_NORMAL = Normal font , high position. (LS100, LS150 models)
PRINT_UP_FORMAT_BOLD = Bold font , high position. (LS100, LS150 models)
String1
First part of the invalidation string.
Length1
Length of the first part of the invalidation string.
Font2
Set the character style for the invalidation string,
String2
First part of the invalidation string.
Length2
Length of the first part of the invalidation string.
Font3
Set the character style for the invalidation string,
PRINT_FORMAT_NORMAL = Normal font, low position.
PRINT_FORMAT_BOLD = Bold font, low position.
PRINT_UP_FORMAT_NORMAL = Normal font , high position. (LS100, LS150 models)
PRINT_UP_FORMAT_BOLD = Bold font , high position. (LS100, LS150 models)
String3
First part of the invalidation string.
Length3
Length of the first part of the invalidation string.
Font4
Set the character style for the invalidation string,
PRINT_FORMAT_NORMAL = Normal font, low position.
PRINT_FORMAT_BOLD = Bold font, low position.
PRINT_UP_FORMAT_NORMAL = Normal font , high position. (LS100, LS150 models)
PRINT_UP_FORMAT_BOLD = Bold font , high position. (LS100, LS150 models)
String4
First part of the invalidation string.
Length4
Length of the first part of the invalidation string.
Return Value
LS_OKAY
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_INVALID_FORMAT
Comments
Supported only by the peripheral LS models equipped with a backside invalidation printer.
For the part of string not needed set it to NULL, i.e. if my string is done of a part of normal and the
other of bold, the parameters Font3, String3, Length3, Font4, String4 and Length4, must be set to
NULL.
Description
Loads up to 4 text lines of invalidation string, which may be printed onto the BACK side of the
document with the ink-jet printer.
Available only on LS150 and LS515 model with the print header of 4 lines.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Font1
Set the character style for the invalidation string,
PRINT_FORMAT_NORMAL = Normal font.
PRINT_FORMAT_BOLD = Bold font.
PRINT_FORMAT_NORMAL_15_CHAR = Normal 15 char for Inch font.
PRINT_FORMAT_DOUBLE_HIGH = Font double high uses two line space.
String1
First part of the invalidation string.
Length1
Length of the first part of the invalidation string.
Font2
Set the character style for the invalidation string,
PRINT_FORMAT_NORMAL = Normal font.
PRINT_FORMAT_BOLD = Bold font.
PRINT_FORMAT_NORMAL_15_CHAR = Normal 15 char for Inch font.
PRINT_FORMAT_DOUBLE_HIGH = Font double high uses two line space.
String2
Second part of the invalidation string.
Length2
Font3
Set the character style for the invalidation string,
PRINT_FORMAT_NORMAL = Normal font.
PRINT_FORMAT_BOLD = Bold font.
PRINT_FORMAT_NORMAL_15_CHAR = Normal 15 char for Inch font.
PRINT_FORMAT_DOUBLE_HIGH = Font double high uses two line space.
String3
Third part of the invalidation string.
Length3
Length of the third part of the invalidation string.
Font4
Set the character style for the invalidation string,
PRINT_FORMAT_NORMAL = Normal font.
PRINT_FORMAT_BOLD = Bold font.
PRINT_FORMAT_NORMAL_15_CHAR = Normal 15 char for Inch font.
PRINT_FORMAT_DOUBLE_HIGH = Font double high uses two line space.
String4
Forth part of the invalidation string.
Length4
Length of the forth part of the invalidation string.
Return Value
LS_OKAY
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_INVALID_FORMAT
Comments
Supported only by the peripheral LS models equipped with a backside 4 lines invalidation printer.
Each string provided in String1 String2 String3 String4 parameters can also not be NULL terminated.
Each line can have a different font .
If a line must not be printed, set the corresponding string to NULL.
Description
Tests whether the cause of the error of the previous command has been removed and resets the
unit.
The function is also used for cleaning the belt of the unit.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
ResetType
Type of reset done :
RESET_ERROR – Reset software of the equipment.
RESET_FREE_PATH – Reset with turn on of the motors.
RESET_BELT_CLEANING – Turn on of the motors for cleaning the belt.
RESET_COUNTER_CARTRIDGE – Reset the counter of the dot printed.
RESET_UNIT_RESERVE – Reset the reservation of the unit.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_PAPER_JAM
LS_INVALID_RESET_TYPE
Comments
The RESET_COUNTER_CARTRIDGE will be called when a cartridge is replaced.
Description
Configures the device in case of Double Leafing (when two documents are picked together instead
of one). It is possible to set the type of behavior, disabled or enabled, when enabled the unit will
return a warning and continue to read the documents, or it will return a blocking error and stop the
document processing loop with the document in the path. It is also possible to change the sensibility
level and the length of the overlapped area before returning the error/warning.
The setting done via this function will be valid until a power off-on of the device or a next double
leafing setting command.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages.
Type
The value accepted are the follows:
DOUBLE_LEAFING_ERROR – Error on Double leafing (default).
DOUBLE_LEAFING_WARNING – Warning on Double leafing.
DOUBLE_LEAFING_DISABLE – Double Leafing sensor disabled.
Value
The range of value accepted are from 0 to 100, the default is 50.
DocMin
Length in millimeter of the minimun doc handled :
Possible values for LS100 : grater than 100
Possible values for LS150 : grater than 80
Possible values for LS515 : grater than 150
Possible values for LS800 : grater than 130
DocMax
Length in millimeter of the maximun doc handled :
Possible values for LS100 : less than 216
Possible values for LS150 : less than 320
Possible values for LS515 : less than 216
Possible values for LS800 : less than 216
Return Value
LS_OKAY
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_PAPER_JAM
Comments
This function, replaces the functions LSConfigDoubleLeafingEx() and LSDoubleLeafingSensibility().
With the LS40 this function return always LS_OKAY for compatibility reason because it doesn’t have
the Double Leafing sensor.
Description
Available only for LS40 and LS150 model.
Changes in a volatile mode the intensity scanner light, when the device is powered Off the value is
lost, and the original default value will be set.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Value
The Range of Value accepted is from 0 to 30.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_INVALID_VALUE
Comments
Description
Available only for LS150 model.
Changes in a volatile mode the Unit speed. (does not write in the flash memory of the device) The
Unit can accept 2 types of speed, 75 doc per minute and 150 doc per minute.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
UnitSpeed
Value accepted :
SPEED_NORMAL – Set the default Unit speed. (150DPM)
SPEED_STAMP – Set for all type of ScanMode the stamp Unit speed. (75 DPM)
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_INVALID_UNIT_SPEED
Comments
Description
This function can be used by the application to obtain detailed information about the LS device
sensors status.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
LpStatus
Pointer to a structure UNITSTATUS that describe the status and the photo of the unit. The
structure is described in the comments section.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_PAPER_JAM
LS_COMMAND_SEQUENCE_ERROR
Comments
Description UNITSTATUS structure :
} UNITSTATUS, *PUNITSTATUS;
0H No sense
2H Unit busy
3H Paper jam
4H Hardware error
5H Illegal request
6H Document not present
9H Double Leafing error
BH Aborted command
40 H Jam at MICR photo
41 H Jam Document to long
42 H Jam at scanner photo
Description
This function can be used by the application to obtain detailed information about the LS device
sensors status.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
SenseKey
Pointer to a byte variable that will contain the sense key status.
Possible values are :
Hex Description
0H No sense
2H Unit busy
3H Paper jam
4H Hardware error
5H Illegal request
6H Document not present
9H Invalid command
40 H Jam at MICR photo
41 H Jam Document to long
42 H Jam at scanner photo
SensorStatus
Pointer to a 16 bytes variable that will contain the sensor status.
The information returned takes on different meanings for different LS models.
The bits must be interpreted in this order:
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
For example if the sensor bit has a value of 0x0E the following bits will be set:
Bit0 = 0
Bit1 = 1
Bit2 = 1
Bit3 = 1
Bit4 = 0
Bit5 = 0
Bit6 = 0
Bit7 = 0
SensorStatus[ byte 1 ]
Bit Description
0 Photo 1 Double leafing covered
1 Photo 2 Double leafing covered
2 Photo 3 Double leafing covered
3 n.u.
4 n.u.
5 n.u.
6 n.u.
7 n.u.
SensorStatus[ byte 1 ]
Bit Description
0 not used
1 First BIN full
2 Second BIN full
3 Double leafing occurred
4 not used
5 not used
6 not used
7 not used
SensorStatus[ byte 0 ]
Bit Description
0 Sorter 1 - photo input pocket 1 covered
1 Sorter 1 - pocket 1 full
2 Sorter 1 - photo input pocket 2 covered
3 Sorter 1 - pocket 2 full
4 Sorter 1 - photo input pocket 3 covered
5 Sorter 1 - pocket 3 full
6 n.u.
7 n.u.
SensorStatus[ byte 1 ]
Bit Description
0 Sorter 2 - photo input pocket 1 covered
1 Sorter 2 - pocket 1 full
2 Sorter 2 - photo input pocket 2 covered
3 Sorter 2 - pocket 2 full
4 Sorter 2 - photo input pocket 3 covered
5 Sorter 2 - pocket 3 full
6 n.u.
SensorStatus[ byte 2 ]
Bit Description
0 Sorter 3 - photo input pocket 1 covered
1 Sorter 3 - pocket 1 full
2 Sorter 3 - photo input pocket 2 covered
3 Sorter 3 - pocket 2 full
4 Sorter 3 - photo input pocket 3 covered
5 Sorter 3 - pocket 3 full
6 n.u.
7 n.u.
SensorStatus[ byte 3 ]
Bit Description
0 Sorter 4 - photo input pocket 1 covered
1 Sorter 4 - pocket 1 full
2 Sorter 4 - photo input pocket 2 covered
3 Sorter 4 - pocket 2 full
4 Sorter 4 - photo input pocket 3 covered
5 Sorter 4 - pocket 3 full
6 n.u.
7 n.u.
SensorStatus[ byte 4 ]
Bit Description
0 Sorter 5 - photo input pocket 1 covered
1 Sorter 5 - pocket 1 full
2 Sorter 5 - photo input pocket 2 covered
3 Sorter 5 - pocket 2 full
4 Sorter 5 - photo input pocket 3 covered
5 Sorter 5 - pocket 3 full
6 n.u.
7 n.u.
SensorStatus[ byte 5 ]
Bit Description
0 n.u.
1 n.u.
2 n.u.
3 n.u.
4 n.u.
5 n.u.
6 n.u.
7 n.u.
SensorStatus[ byte 6 ]
Bit Description
0 n.u.
1 n.u.
2 n.u.
3 Photo Double Leafing 1 covered
4 Photo Double Leafing 2 covered
5 Photo Double Leafing 3 covered
6 n.u.
7 n.u.
SensorStatus[ byte 7 ]
Bit Description
0 if 0 - Documents present in the feeder. if 1 - Feeder empty
SensorStatus[ byte 8 ]
Reserved
SensorStatus[ byte 9 ]
Bit Description
0 Sorter 6 - photo input pocket 1 covered
1 Sorter 6 - pocket 1 full
2 Sorter 6 - photo input pocket 2 covered
3 Sorter 6 - pocket 2 full
4 Sorter 6 - photo input pocket 3 covered
5 Sorter 6 - pocket 3 full
6 n.u.
7 n.u.
SensorStatus[ byte 10 ]
Bit Description
0 Sorter 7 - photo input pocket 1 covered
1 Sorter 7 - pocket 1 full
2 Sorter 7 - photo input pocket 2 covered
3 Sorter 7 - pocket 2 full
4 Sorter 7 - photo input pocket 3 covered
5 Sorter 7 - pocket 3 full
6 n.u.
7 n.u.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_PAPER_JAM
LS_COMMAND_SEQUENCE_ERROR
Comments
More information about the sensor status may be found in the specific LS device manuals.
Description
Set the criteria to apply in sorting documents, it is possible to set a maximum of MAX_CRITERIA
selection criteria. This command is available on LS510, LS515 models.
Parameters
hConnect
Handle returned by LSConnect
hwnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
pCriteria
Pointer to a DATASORTERSELECT structure (see Comments section below) that specifies
the criteria to apply for sorting the documents and deciding the destination storage bin.
NrCriteria
Number of criteria structures in pCriteria . This value cannot be greater than
MAX_CRITERIA
Return Value
LS_OKAY
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_SYSTEM_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
Comments
In case more than one sorting criteria is provided, make sure that the structures are all contiguous,
one after the other.
Description :
CharToStart
Initial character in the codeline used as starting character of the codeline comparison
string.
NrCharCheck
Number of characters to include in the comparison string.
String1
First reference string compared to the codeline comparison string.
String2
Second reference string compared to the codeline comparison string.
Bin
Destination Bin for documents that meet TypeCriteria
Description
Set the dimensions and character set to use by the decoding algorithm applied to the section of
documents that will be processed.
This function must be invoked before LSDocHandle.
It works on the LS100 units which have the DSP option installed.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
pDimWindows
Pointer to a DATAOPTICALWINDOW structure that specifies the dimensions of the portions
of document that must be read and the type of the character that must be read.
NrWindos
Number of windows that must be read. This value cannot be grater 1 for LS100 series.
Return Value
LS_OKAY
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_SYSTEM_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
Comments
The DATAOPTICALWINDOW structure is as follows :
Reserved
Must be set to 0.
XRightBottom
X coordinate in millimetre from the right bottom corner of the document.
YRightBottom
Y coordinate in millimetre from the right bottom corner of the document.
XLeftTop
X coordinate in millimetre from the right bottom corner of the document.
YLeftTop
Y coordinate in millimetre from the right bottom corner of the document (this
parameter accept only the value YRightBottom + 10).
The coordinate millimetres pair 0,0 refers to the bottom right hand corner of the document.
Example :
YRightBottom
XLeftTop XRightBottom
Description
The function disable or enable the peripheral timeout on insert documents, by default the timeout is
enabled.
Function available only with the LS100, LS150 and LS51x model.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Value
TRUE disable the timeout.
FALSE enable the timeout.
Return Value
LS_OKAY
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_OPEN_NOT_DONE
Comments
This performance on LS510 is available only from the firmware version 2.23 or later.
Description
Function available only with the LS51x and LS150 models.
Change the position of the stamps placed on the front of the processed document.
Parameters
hConnect
Handle returned by LSConnect
hwnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Step
This parameter specifies the advancement of the motor, in number of steps, before starting
to stamp.
LS515 valid range is 0 to 25, each step unit corresponds to 2.5 mm.
0 – The stamping is done at the beginning of the document ( default value ).
25 – The stamping is done at the end of the document of 216 mm in length.
Reserved
This parameter must be set to 0.
Return Value
LS_OKAY
LS_PERIPHERAL_NOT_FOUND
LS_PAPER_JAM
LS_OPEN_NOT_DONE
LS_COMMAND_NOT_SUPPORTED
LS_COMMAND_SEQUENCE_ERROR
LS_INVALID_TYPE_COMMAND
LS_INVALID_FORMAT
Comments
This function is not applicable to LS100, LS5xx series.
Description
Retrieve the historical data stored inside the LS device non volatile memory.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
sHistory
Structure containing the historical data returned by the device.
The field Size of the structure must be set with the sizeof of the gived structure.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_COMMAND_SEQUENCE_ERROR
Comments
Description of the UnitHistory structure :
} UNITHISTORY, *PUNITHISTORY;
For the LS800 it is advisable that you use these functions, in order to achieve the maximum speed of the
unit.
The same applies to all the LS family scanners models, if you use these functions multiple documents will be
in the path at the same time, thus obtaining the maximum throughput out of the unit.
The speed of the machine will be completely independend of the application speed.
Description
Handle documents in a cycle according to the options specified by the various parameters.
This function can be used to automatically handle documents on the LS40, LS100, LS150, LS515
and LS510S models. It must be called before the LSGetDocData() loop. To disable the wait timeout
after the last document the LSDisableWaitDocument() function must be called prior to the
LSAutoDocHandle().
Please also refer to the LSConfigDoubleLeafingAndDocLenght() function to configure the
paper sensibility in the correct way to handle the double leafing functionality.
NOTE : LS100 model does NOT support the 300 dpi resolution.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Stamp
NO_STAMP = do not stamp document
Validate
NO_PRINT_VALIDATE = do not print validation string
PRINT_VALIDATE = print validation string (the text of the validation string must be loaded
using the LSLoadString command before invoking this command). The LS
device must be equipped with the optional validation printer.
PRINT_DIGITAL_VALIDATE = print digital validation string on the image (the text of the
validation string must be loaded using the
LSLoadDigitalStringWithCounter command before invoking this
command)
Codeline
Specify the type of codeline to read.
NO_READ_CODELINE = do not read codeline.
ScanMode
This parameter set the resolution for the image to read Accepted values are :
SCAN_MODE_BW = black and white at 200 dpi
SCAN_MODE_16GR100 = 16 shades of grey, at 100 dpi
SCAN_MODE_16GR120 = 16 grey scale at 120 dpi
SCAN_MODE_16GR200 = 16 shades of grey, at 200 dpi
SCAN_MODE_16GR240 = 16 grey scale at 240 dpi
SCAN_MODE_16GR300 = 16 grey scale at 300 dpi
SCAN_MODE_256GR100 = 256 grey scale at 100 dpi
SCAN_MODE_256GR120 = 256 grey scale at 120 dpi
SCAN_MODE_256GR200 = 256 grey scale at 200 dpi
SCAN_MODE_256GR240 = 256 grey scale at 240 dpi
SCAN_MODE_256GR300 = 256 grey scale at 300 dpi
SCAN_MODE_256GR100_AND_UV = 256 gray scale at 100 dpi and Ultra Violet images
SCAN_MODE_256GR200_AND_UV = 256 gray scale at 200 dpi and Ultra Violet images
SCAN_MODE_256GR300_AND_UV = 256 gray scale at 300 dpi and Ultra Violet images
SCAN_MODE_COLOR_100 = Color 24 bit 100 dpi
SCAN_MODE_COLOR_200 = Color 24 bit 200 dpi
SCAN_MODE_COLOR_300 = Color 24 bit 300 dpi
SCAN_MODE_COLOR_100_AND_UV = 256 gray scale at 100 dpi and Ultra Violet images
SCAN_MODE_COLOR_200_AND_UV = 256 gray scale at 200 dpi and Ultra Violet images
SCAN_MODE_COLOR_300_AND_UV = 256 gray scale at 300 dpi and Ultra Violet images
SCAN_MODE_256GR100BN = 256 gray scale at 100 dpi Brutto and Netto images (LS515
model only)
SCAN_MODE_256GR200BN = 256 gray scale at 200 dpi Brutto and Netto images (LS515
model only)
SCAN_MODE_COLOR_AND_RED_100 = Color 24 bit at 100 dpi and Netto images (LS100
and LS515 model)
SCAN_MODE_COLOR_AND_RED_200 = Color 24 bit at 200 dpi and Netto images (LS100
and LS515 model)
SCAN_MODE_256GR100_ONLY_RED = 256 gray scale at 100 dpi Red images
SCAN_MODE_256GR200_ONLY_RED = 256 gray scale at 200 dpi Red images
SCAN_MODE_256GR300_ONLY_RED = 256 gray scale at 300 dpi Red images
Feeder
It specifies the source of the document
AUTO_FEED = document from feeder.
PATH_FEED = document from path. This value should be used when the document
processing requires two or more passes. It requires that in the previous
pass the value set for Sorter parameter is HOLD_DOCUMENT
Sorter
It specifies the destination of the processed document. The applicable values depend on the
model of LS device being used :
HOLD_DOCUMENT = hold document. In the next pass the parameter Feeder must take the
value PATHFEED
SORTER_BAY1 = document is stacked in sorting pocket 1.
SORTER_BAY2 = document is stacked in sorting pocket 2
SORTER_AUTOMATIC = send the document to the destination set by a previous
LSSetSorterCriteria command.
SORTER_SWITCH_1_TO_2 = documents are stacked in Pocket 1, until it becomes full at
which point stacking continues to Pocket 2. When Pocket 2 becomes full the
service will return a LS_SORTERS_BOTH_FULL error code.
SORTER_ON_CODELINE_CALLBACK_WITH_PRINT = the application decides the
destination pocket after reading the MICR codeline in a call-back function
and the print of the stringa start always at the same point from the edge of
NumDocument
This parameter set the maximum number of documents to read.
0 = read all documents present in the feeder at intervals of 6 seconds one from the other.
ClearBlack
This sets the option for either cleaning or keeping the black area that may be present around
the scanned image
NO_CLEAR_BLACK = no image cleaning, the black area is not removed.
CLEAR_ALL_BLACK = clean the document's image removing all the black around the
image according to the level of filter specified by
LSSetThresholdClearBlack command.
CLEAR_AND_ALIGN_IMAGE = removing all the black around the image and align the
document’s image. (deskew)
Side
It specifies which side(s) of the document to scan
SIDE_FRONT_IMAGE = Scan Front side.
SIDE_BACK_IMAGE = Scan Rear side.
SIDE_ALL_IMAGE = Scan Both sides.
SIDE_NONE_IMAGE = Do not scan document.
ScanDocType
Specifies the type of document to processed.
Accepted values are :
SCAN_PAPER_DOCUMENT : for paper.
SCAN_A4_DOCUMENT : for scan document A4 (only for LS150 G).
SaveImage
Specifies where to store the scanned image(s)
IMAGE_SAVE_ON_FILE = save the image on file
IMAGE_SAVE_HANDLE = save the image in memory
IMAGE_SAVE_BOTH = save the image in memory and on file
IMAGE_SAVE_NONE = do not save on file nor in memory.
DirectoryFile
Path of the Directory where to save the image(s), without file name.
BaseFilename
Root of the file name given to all stored images. For example, if this parameter is set to be
equal to AA and the chosen File Format is JPEG, the first file created will be named
AA0FF.jpg, with the FF postfix for front images and the BB postfix for rear images.
pos_X
Specify the x co-ordinates of the codeline. Reference point and unit of measure as of
OriginMeasureDoc parameter.
pos_Y
Specify the y co-ordinates of the codeline, from the bottom margin of the document. Unit of
measure as of OriginMeasureDoc parameter.
SizeW
Specify the size of the window that contained codeline in the image. Unit of measure as of
OriginMeasureDoc parameter.
SizeH
Specify the height of the codeline.
For the moment accept only the values :
OCR_VALUE_IN_MM in case of measures in millimeters.
OriginMeasureDoc
Specifies the reference point and unit of measure of the document from which
measurements start. It can take the following values:
BOTTOM_LEFT_PIXEL = Start from bottom left hand corner. Measures expressed in pixels.
BOTTOM_RIGHT_MM = Start from bottom right hand corner. Measures expressed in
millimeters.
BOTTOM_RIGHT_INCH = Start from bottom right hand corner. Measures expressed in
inches.
OCR_Image_Side
This parameter specifies the document side to use to read the codeline
OCR_FRONT_IMAGE : use the front side image
OCR_BACK_IMAGE : use the back side image
FileFormat
This parameter specifies the file format used when storing the document's images.
The valid values are :
SAVE_JPEG : save the image in a JPEG format file.
SAVE_BMP : save the image in a DIB format file.
FILE_TIF : save the image in a Tagged Image File Format file.
SAVE_TIF_JPEG = Image TIFF saved in JPEG format.
FILE_CCITT : save the image in a TIFF CCITT file.
FILE_CCITT_GROUP3_1DIM : save the image in a CCITT Group3 one dimension file.
FILE_CCITT_GROUP3_2DIM : save the image in a CCITT Group3 two dimensions file.
FILE_CCITT_GROUP4 : save the image in a CCITT Group4 two dimensions file.
Quality
Integer from 2 to 255 that indicates the relationship between quality and compression:
2 = maximum quality.
255 = maximum compression.
SaveMode
SAVE_OVERWRITE = Overwrite the file. Applicable to all supported values of parameter
FileFormat
SAVE_APPEND = Append the image in a multipage file images. Not applicable to JPEG
and DIB file formats
SAVE_REPLACE = Replace a image in a multipage file images. Not applicable to JPEG
and DIB file formats
SAVE_INSERT = Insert the image in a multipage file images. Not applicable to JPEG and
DIB file formats
WaitTimeout
This parameter sets the behavior of the device when there are no more documents to
process.
WAIT_YES = the device waits for approximately 7 seconds for a new document to process,
when this internal timer expires and there is not a new document to process
the command completes with return code LS_FEEDER_EMPTY .
WAIT_NO = if no document is present, or after the last document in the feeder has been
processed, the service will immediately complete with return code
LS_FEEDER_EMPTY.
This parameter allow to wait the peripheral timeout after the last document in the leafer.
Beep
Specifies whether the internal beeper should emit an acoustical sound when an error occurs.
Accepted values are :
NO_BEEP : do not activate beeper
BEEP : activate beeper
userfunc
Call-back function called from the library when the codeline is available. If this function is not
provided (NULL) the application will retrieve the codeline string upon the LSGetDocData
function call only. If the userfunc parameter is provided, the application will retrieve the
codeline string as a parameter on the userfunc call and when calling the LSGetDocData
function, as well. The output pocket is decided by the application by providing a valid sorter
number during the callback function call. Refer to the structure described hereafter.
This function is available only with the ls515.
Reserved2
Reserved for future use. Must be set to NULL.
Reserved3
Reserved for future use. Must be set to NULL.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_RESERVED_ERROR
LS_PAPER_JAM
LS_COMMAND_IN_EXECUTION_YET
LS_JPEG_ERROR
Comments
Note :
If the application is requesting to read MicroHole codeline, the function will force the resolution at 300
dpi. The image returned, however, will be the one requested by the application.
Description
Handle documents in a cycle according to the options specified by the various parameters.
This function was expecially developed for Visual Basic programming where callback functions must
be defined as Standard Call.
Refer to LsAutoDocHandle for parameters and description.
Parameters
See the LSAutoDocHandle() function.
Return Value
See the LSAutoDocHandle() function.
Comments
When the SaveImage parameter is set to IMAGE_SAVE_HANDLE or IMAGE_SAVE_BOTH, this
function will allocate a memory image buffer for each document. After this function processing
completes the application must call the LSGetDocData to retrieve the image handles, display the
images and then free the memory buffer.
Description
This function handles documents in a cycle according to the options specified by the various
parameters.
The sorting and the ink-jet of the documents are decided by the application in the post-routine. This
can be done or after having read the codeline in the associated call-back function, or after having
read the front image in the associated call-back function.
The Post-Routine must be a very short piece of code that must decide the pocket according to the
MICR codeline returned by the peripheral or some information retrieved from the image. This
information can be for example a OCR line, obtained with the function
LSCodelineReadFromBitmap().
Note that all the information of each single document are returned all together in a second time on
the LSGetDocData() function call.
Only one call-back function address can be provided at the same time.
Please refer to the LSConfigDoubleLeafingEx() function to configure the paper sensibility in
the correct way to handle the double leafing functionality.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
Validate
NO_PRINT_VALIDATE = do not print validation string.
PRINT_VALIDATE = print validation string (the text of the validation string must be loaded
using the LSLoadString command before invoking this command). The LS
device must be equipped with the optional validation printer.
Codeline
Specify the type of codeline to read.
NO_READ_CODELINE = do not read codeline.
READ_CODELINE_MICR = read magnetic codeline, either CMC7 or E13B.
Software read :
READ_BARCODE_PDF417 = read in optical mode a PDF417 barcode.
READ_BARCODE_2_OF_5 = read in optical mode a 2_OF_ 5 barcode.
READ_BARCODE_CODE39 = read in optical mode a CODE 39 barcode.
READ_BARCODE_CODE128 = read in optical mode a CODE 128 barcode.
READ_CODELINE_SW_OCRA = read codeline from the position specified by X, Y and Size
parameters. The co-ordinate start from bottom right corner of the document.
READ_CODELINE_SW_OCRB_NUM = read codeline from the position specified by X, Y
and Size parameters. The co-ordinate start from bottom right corner of the
document.
READ_CODELINE_SW_OCRB_ALFANUM = read codeline from the position specified by
X, Y and Size parameters. The co-ordinate start from bottom right corner of
the document.
READ_CODELINE_SW_OCRB_ITALY = read codeline from the position specified by X, Y
and Size parameters. This font is a subset of the alfa-numeric font without
the character ‘&’ and same separator. The co-ordinate start from bottom
right corner of the document.
READ_CODELINE_SW_E13B = read codeline from the position specified by X, Y and Size
parameters. The co-ordinate start from bottom right corner of the document.
READ_CODELINE_SW_CMC7 = read codeline from the position specified by X, Y and Size
parameters. The co-ordinate start from bottom right corner of the
document.
READ_CODELINE_SW_ E13B_X_OCRB = read codeline from the position specified by X,
Y and Size parameters. The co-ordinate start from bottom right corner of the
document.
Side
It specifies which side(s) of the document to scan
SIDE_FRONT_IMAGE = Scan Front side
SIDE_BACK_IMAGE = Scan Rear side
SIDE_ALL_IMAGE = Scan Both sides
SIDE_NONE_IMAGE = Do not scan document
ScanModeFront
This parameter set the resolution for the image to read. Accepted values are :
SCAN_MODE_BW = black and white at 200 dpi
SCAN_MODE_16GR100 = 16 shades of grey, at 100 dpi
SCAN_MODE_16GR200 = 16 shades of grey, at 200 dpi
SCAN_MODE_256GR100 = 256 shades of grey, at 100 dpi
SCAN_MODE_256GR200 = 256 shades of grey, at 200 dpi
SCAN_MODE_COLOR_100 = colour at 100 dpi
SCAN_MODE_COLOR_200 = colour at 200 dpi
ScanModeBack
This parameter set the resolution for the image to read Accepted values are :
SCAN_MODE_BW = black and white at 200 dpi
SCAN_MODE_16GR100 = 16 shades of grey, at 100 dpi
ClearBlack
This sets the option for either cleaning or keeping the black area that may be present around
the scanned image
NO_CLEAR_BLACK = no image cleaning, the black area is not removed.
CLEAR_ALL_BLACK = clean the document's image removing all the black around the
image according to the level of filter specified by
LSSetThresholdClearBlack command.
CLEAR_AND_ALIGN_IMAGE = removing all the black around the image and align the
document’s image.
NumDocument
This parameter set the maximum number of documents to read.
0 = read all documents present in the feeder at intervals of 6 seconds one from the other.
SaveImage
Specifies where to store the scanned image(s)
IMAGE_SAVE_HANDLE = save the image in memory.
IMAGE_SAVE_ON_FILE = save the image on file.
IMAGE_SAVE_BOTH = save the image in memory and on file.
IMAGE_SAVE_NONE = do not save on memory nor on file.
DirectoryFile
Path of the Directory where to save the image(s), without file name.
BaseFilename
Root of the file name given to all stored images. For example, if this parameter is set to be
equal to AA and the chosen File Format is JPEG, the first file created will be named
AA0FF.jpg, with the FF postfix for front images and the BB postfix for rear images.
UnitMeasure
Specify whether the Start_X, Start_Y and SizeW measures are expressed in millimeters or
in inches.
The possible values are either UNIT_MM or UNIT_INCH.
Start_X
Specify the x co-ordinate from right hand margin of the document. The value must be
consistent with the UnitMeasure.
Start_Y
Specify the y co-ordinate from bottom margin of the document. The value must be consistent
with the UnitMeasure.
SizeW
Specify the width of the window on the image bitmap that will be processed by the decoding
software. The value must be consistent with the UnitMeasure.
SizeH
Specify the height of the window on the image bitmap that will be processed by the decoding
software.
Valid values are :
OCR_VALUE_IN_MM for measures expressed in millimeters.
OCR_VALUE_IN_INCH for measures expressed in inches.
OCR_Image_Side
FileFormat
This parameter specifies the file format used when storing the document's images.
The valid values are :
SAVE_JPEG : save the image in a JPEG format file.
SAVE_BMP : save the image in a DIB format file.
FILE_TIF : save the image in a Tagged Image File Format file.
SAVE_TIF_JPEG = Image TIFF saved in JPEG format.
FILE_CCITT : save the image in a TIFF CCITT file.
FILE_CCITT_GROUP3_1DIM : save the image in a CCITT Group3 one dimension file.
FILE_CCITT_GROUP3_2DIM : save the image in a CCITT Group3 two dimensions file.
FILE_CCITT_GROUP4 : save the image in a CCITT Group4 two dimensions file.
Quality
Integer from 2 to 255 that indicates the relationship between quality and compression:
2 = maximum quality.
255 = maximum compression.
SaveMode
SAVE_OVERWRITE = Overwrite the file. Applicable to all supported values of parameter
FileFormat.
SAVE_APPEND = Append the image in a multi-page file images. Not applicable to JPEG
and DIB file formats.
SAVE_REPLACE = Replace a image in a multi-page file images. Not applicable to JPEG
and DIB file formats.
SAVE_INSERT = Insert the image in a multi-page file images. Not applicable to JPEG and
DIB file formats.
PageNumber
An integer indicating the position inside a multi-page file.
Beep
Specifies whether the internal beeper should emit an acoustical sound when an error occurs.
Accepted values are :
BEEP_NO : do not activate beeper.
BEEP_YES : activate beeper.
userfunc1
Call-back function called from the library then the codeline is available.
userfunc2
Call-back function called from the library then the front image is available.
userfunc3
Call-back function called from the library then the back image is available (not available at
this moment).
Reserved1
Reserved for future use. Must be set to NULL.
Reserved2
Reserved for future use. Must be set to NULL.
Reserved3
Reserved for future use. Must be set to NULL.
Comments
When the SaveImage parameter is set to IMAGE_SAVE_HANDLE or IMAGE_SAVE_BOTH, this
function will allocate a memory image buffer for each document. After this function processing
completes the application must call the LS800_GetDocData to retrieve the image handles, process
the images and then free the memory buffer.
The images buffers must be released by the application with the function LS800_FreeImage().
} S_CODELINE_INFO_LS800, *LPS_CODELINE_INFO_LS800;
} S_IMAGE_INFO_LS800, *LPS_IMAGE_INFO_LS800;
Description
This function is similar to the LS800_AutoDocHandle() function but is expecially developed for
Visual Basic programming Language.
The main differences are the structures given as parameter on the callback functions.
In these structures some fields are defined as type UNICODE instead of ASCII.
Parameters
See the LS800_AutoDocHandle() function.
Return Value
See the LS800_AutoDocHandle() function.
Comments
Description of the structures provided as parameter in the call-back functions.
} S_CODELINE_INFO_VB_LS800, *LPS_CODELINE_INFO_VB_LS800;
Description
This function handles documents in a cycle according to the options specified by the various
parameters.
The sorting and the ink-jet of the documents are decided by the application in the post-routine. This
can be done or after having read the codeline in the associated call-back function, or after having
read the front image in the associated call-back function.
The Post-Routine must be a very short piece of code that must decide the pocket according to the
MICR codeline returned by the peripheral or some information retrieved from the image. This
information can be for example a OCR line, obtained with the function
LSCodelineReadFromBitmap().
Note that all the information of each single document are returned all together in a second time on
the LSGetDocData() function call.
Only one call-back function address can be provided at the same time.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Codeline
Specify the type of codeline to read.
NO_READ_CODELINE = do not read codeline.
READ_CODELINE_MICR = read magnetic codeline, either CMC7 or E13B.
Software read :
READ_BARCODE_PDF417 = read in optical mode a PDF417 barcode.
READ_BARCODE_2_OF_5 = read in optical mode a 2_OF_ 5 barcode.
READ_BARCODE_CODE39 = read in optical mode a CODE 39 barcode.
READ_BARCODE_CODE128 = read in optical mode a CODE 128 barcode.
READ_CODELINE_SW_OCRA = read codeline from the position specified by X, Y and Size
parameters. The co-ordinate start from bottom right corner of the document.
READ_CODELINE_SW_OCRB_NUM = read codeline from the position specified by X, Y
and Size parameters. The co-ordinate start from bottom right corner of the
document.
READ_CODELINE_SW_OCRB_ALFANUM = read codeline from the position specified by
X, Y and Size parameters. The co-ordinate start from bottom right corner of
the document.
READ_CODELINE_SW_OCRB_ITALY = read codeline from the position specified by X, Y
and Size parameters. This font is a subset of the alfa-numeric font without
the character ‘&’ and same separator. The co-ordinate start from bottom
right corner of the document.
READ_CODELINE_SW_E13B = read codeline from the position specified by X, Y and Size
parameters. The co-ordinate start from bottom right corner of the document.
READ_CODELINE_SW_ E13B_X_OCRB = read codeline from the position specified by X,
Y and Size parameters. The co-ordinate start from bottom right corner of the
document.
Side
It specifies which side(s) of the document to scan
SIDE_FRONT_IMAGE = Scan Front side
SIDE_BACK_IMAGE = Scan Rear side
SIDE_ALL_IMAGE = Scan Both sides
SIDE_NONE_IMAGE = Do not scan document
ScanModeFront
This parameter set the resolution for the image to read. Accepted values are :
SCAN_MODE_BW = black and white at 200 dpi
SCAN_MODE_16GR100 = 16 shades of grey, at 100 dpi
SCAN_MODE_16GR200 = 16 shades of grey, at 200 dpi
SCAN_MODE_256GR100 = 256 shades of grey, at 100 dpi
SCAN_MODE_256GR200 = 256 shades of grey, at 200 dpi
SCAN_MODE_COLOR_100 = colour at 100 dpi
SCAN_MODE_COLOR_200 = colour at 200 dpi
ScanModeBack
This parameter set the resolution for the image to read Accepted values are :
SCAN_MODE_BW = black and white at 200 dpi
SCAN_MODE_16GR100 = 16 shades of grey, at 100 dpi
SCAN_MODE_16GR200 = 16 shades of grey, at 200 dpi
SCAN_MODE_256GR100 = 256 shades of grey, at 100 dpi
SCAN_MODE_256GR200 = 256 shades of grey, at 200 dpi
SCAN_MODE_COLOR_100 = Color 24 bit 100 dpi
ClearBlack
This sets the option for either cleaning or keeping the black area that may be present around
the scanned image
NO_CLEAR_BLACK = no image cleaning, the black area is not removed.
CLEAR_ALL_BLACK = clean the document's image removing all the black around the
image according to the level of filter specified by
LSSetThresholdClearBlack command.
CLEAR_AND_ALIGN_IMAGE = removing all the black around the image and align the
document’s image.
NumDocument
This parameter set the maximum number of documents to read.
0 = read all documents present in the feeder at intervals of 6 seconds one from the other.
SaveImage
Specifies where to store the scanned image(s)
IMAGE_SAVE_HANDLE = save the image in memory.
IMAGE_SAVE_ON_FILE = save the image on file.
IMAGE_SAVE_BOTH = save the image in memory and on file.
IMAGE_SAVE_NONE = do not save on memory nor on file.
DirectoryFile
Path of the Directory where to save the image(s), without file name.
BaseFilename
Root of the file name given to all stored images. For example, if this parameter is set to be
equal to AA and the chosen File Format is JPEG, the first file created will be named
AA0FF.jpg, with the FF postfix for front images and the BB postfix for rear images.
UnitMeasure
Specify whether the Start_X, Start_Y and SizeW measures are expressed in millimeters or
in inches.
The possible values are either UNIT_MM or UNIT_INCH.
Start_X
Specify the x co-ordinate from right hand margin of the document. The value must be
consistent with the UnitMeasure.
Start_Y
Specify the y co-ordinate from bottom margin of the document. The value must be consistent
with the UnitMeasure.
SizeW
Specify the width of the window on the image bitmap that will be processed by the decoding
software. The value must be consistent with the UnitMeasure.
SizeH
Specify the height of the window on the image bitmap that will be processed by the decoding
software.
Valid values are :
OCR_VALUE_IN_MM for measures expressed in millimeters.
OCR_VALUE_IN_INCH for measures expressed in inches.
OCR_Image_Side
This parameter specifies the document side to use to read the codeline
OCR_FRONT_IMAGE : use the front side image
OCR_BACK_IMAGE : use the back side image
Quality
Integer from 2 to 255 that indicates the relationship between quality and compression:
2 = maximum quality.
255 = maximum compression.
SaveMode
SAVE_OVERWRITE = Overwrite the file. Applicable to all supported values of parameter
FileFormat.
SAVE_APPEND = Append the image in a multi-page file images. Not applicable to JPEG
and DIB file formats.
SAVE_REPLACE = Replace a image in a multi-page file images. Not applicable to JPEG
and DIB file formats.
SAVE_INSERT = Insert the image in a multi-page file images. Not applicable to JPEG and
DIB file formats.
PageNumber
An integer indicating the position inside a multi-page file.
Beep
Specifies whether the internal beeper should emit an acoustical sound when an error occurs.
Accepted values are :
BEEP_NO : do not activate beeper.
BEEP_YES : activate beeper.
SortOnChoice
Specifies which is call-back function valid to select the pocket.
Accepted values are :
SORT_ON_MICR : Sort selection on MICR call-back function.
SORT_ON_FRONT_IMAGE : Sort selection on Front image call-back function.
userfunc1
Call-back function called from the library then the codeline is available.
userfunc2
Call-back function called from the library then the front image is available.
userfunc3
Call-back function called from the library then the back image is available.
Reserved1
Reserved for future use. Must be set to NULL.
Reserved2
Reserved for future use. Must be set to NULL.
Reserved3
Reserved for future use. Must be set to NULL.
Comments
When the SaveImage parameter is set to IMAGE_SAVE_HANDLE or IMAGE_SAVE_BOTH, this
function will allocate a memory image buffer for each document. After this function processing
completes the application must call the LS800_GetDocData to retrieve the image handles, process
the images and then free the memory buffer.
The images buffers must be released by the application with the function LS800_FreeImage().
} S_CODELINE_INFO_LS800, *LPS_CODELINE_INFO_LS800;
} S_IMAGE_INFO_LS800, *LPS_IMAGE_INFO_LS800;
#include "LSApi.h"
Description
This function should be used to retrieve the information about the documents processed by
LSAutoDocHandle. If no document has been processed the function returns a LS_FEEDER_EMPTY
completion code.
If the LsAutoDocHandle is called with NumDocument parameter set to 0, the application must call
the LSGetDocData function in a loop until LS_FEEDER_EMPTY completion code or an error code is
returned.
When the function return a warning of destination sorter full, the application must continue call the
function until return LS_NO_OTHER_DOCUMENT.
Note that if a double leafing occurs, this error code is returned by the LSGetDocData function itself, it
is very important that the application handles this situation in the correct way.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
NrDoc
Progressive sequence number identifying the document whose data is retrieved by this
function.
FilenameFront
Full pathname of the file where the front image is stored. (max 128)
FilenameBack
Full pathname of the file where the back image is stored. (max 128)
Reserved1
Reserved for future use. Must be set to NULL.
*FrontImage
Pointer to a handle where will be returned the handle of memory buffer containing the front
side image of the requested document, in DIB format.
*RearImage
Pointer to a handle where will be returned the handle of memory buffer containing the rear
side image of the requested document, in DIB format.
*FrontImage2
Pointer to a handle where will be returned the handle of memory buffer containing the Ultra
Violet front side image of the requested document, in DIB format.
*RearImage2
Reserved for future use. Must be set to NULL.
CodelineSW
This field will return the codeline data read using the software interpretation algorithm
CodelineHW
This field will return the codeline data read using the MICR reader . This buffer will be filled
also in case Magnetic and Optical is requested.
Barcode
This field will return the barcode codeline data, either PDF417 or 2_OF_5, read using the
barcode reader.
CodelinesOptical
This field will return the OCR codeline data read using the OCR reader.
*DocToRead
Not used.
*NrPrinted
Variable where it will be returned the progressive count number physically endorsed on the
documents. A previous LSLoadStringWithCounterEx() call has to be done.
*Reserved5
Reserved for future use. Must be set to NULL.
*Reserved6
Reserved for future use. Must be set to NULL.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_PAPER_JAM
LS_INVALID_COMMAND
LS_FEEDER_EMPTY
LS_DOUBLE_LEAFING_WARNING
LS_DOUBLE_LEAFING_ERROR
LS_LOOP_INTERRUPTED
LS_REPLACE_CARTRIDGE
#include "LSApi.h"
Description
This function is same to LSGetDocData() function, but return also the Micro codelines if the
parameter Codeline of the function LSAutoDocHandle() is set to
READ_CODELINE_MICR_AND_MICRO_HOLES or
READ_CODELINE_CMC7_MOCR_AND_MICRO_HOLES.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
NrDoc
Progressive sequence number identifying the document whose data is retrieved by this
function.
FilenameFront
Full pathname of the file where the front image is stored. (max 128)
FilenameBack
Full pathname of the file where the back image is stored. (max 128)
Reserved1
Reserved for future use. Must be set to NULL.
Reserved2
Reserved for future use. Must be set to NULL.
*RearImage
Pointer to a handle where will be returned the handle of memory buffer containing the rear
side image of the requested document, in DIB format.
*FrontImage2
Pointer to a handle where will be returned the handle of memory buffer containing the Ultra
Violet front side image of the requested document, in DIB format.
*RearImage2
Reserved for future use. Must be set to NULL.
CodelineSW
This field will return the codeline data read using the software interpretation algorithm
CodelineHW
This field will return the codeline data read using the MICR reader . This buffer will be filled
also in case Magnetic and Optical is requested.
Barcode
This field will return the barcode codeline data, either PDF417 or 2_OF_5, read using the
barcode reader.
CodelinesOptical
This field will return the OCR codeline data read using the OCR reader.
*DocToRead
Not used.
*NrPrinted
Variable where it will be returned the progressive count number physically endorsed on the
documents. A previous LSLoadStringWithCounterEx() call has to be done.
VerifyHole
Specify to verify if the hole of the codeline are micro perforated.
UnitMeasure
Specify whether the Start_X, Start_Y, SizeW and SizeH measures are expressed in
millimeters or in inches.
The possible values are either UNIT_MM or UNIT_INCH.
nrRegions
Number of codeline to decode.
stMicroHole
Array of struct of parameter of each region, described in Comments section of the function
LSReadMicroHolesCodelines().
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_PAPER_JAM
Comments
The image handle retrieved by this function must be released by the application.
In case more than one Optic Codeline is returned they are separated by a space character.
Description
This function should be used to retrieve the information about the documents processed by
LSAutoDocHandle. If no document has been processed the function returns a LS_FEEDER_EMPTY
completion code.
If the LsAutoDocHandle is called with NumDocument parameter set to 0, the application must call
the LSGetDocData function in a loop until LS_FEEDER_EMPTY completion code or an error code is
returned.
When the function return a warning of destination sorter full, the application must continue call the
function until return LS_NO_OTHER_DOCUMENT.
Note that if a double leafing occurs, this error code is returned by the LSGetDocData function itself, it
is very important that the application handles this situation in the correct way.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
CompressionPlace
Valid parameter ONLY in case of LSConnect connection.
Place where the compression will be done, the value accepted are :
COMPRESSION_ON_PC : the image will be sent from the LSConnect to PC in RAW mode
and the relative conversion will be done on the PC ( fast way ).
COMPRESSION_ON_LSCONNECT : the compression will be done on board on the
LSConnect and after the images will be sent to the PC ( slow way ).
DpiImagesJPEG
Specified the DPI resolution of the JPEG images returned, the value accepted are :
IMAGES_RESOLUTION_100_DPI : Images at 100 dpi.
IMAGES_RESOLUTION_200_DPI : Images at 200 dpi.
IMAGES_RESOLUTION_300_DPI : Images at 300 dpi.
*FrontImageJPEG
Pointer to a handle where will be returned the handle of memory buffer containing the front
side image of the requested document, in JPEG format. If this parameter is set to NULL the
images will not returned.
*SizeFrontImageJPEG
Pointer to an integer where will be returned the size of the Front image in JPEG format.
*pRearImageJPEG
Pointer to a handle where will be returned the handle of memory buffer containing the rear
side image of the requested document, in JPEG format. If this parameter is set to NULL the
images will not returned.
*SizeRearImageJPEG
Pointer to an integer where will be returned the size of the Rear image in JPEG format.
DpiImagesTIFF
Specified the DPI resolution of the TIFF images returned, the value accepted are :
IMAGES_RESOLUTION_100_DPI : Images at 100 dpi.
IMAGES_RESOLUTION_200_DPI : Images at 200 dpi.
IMAGES_RESOLUTION_300_DPI : Images at 300 dpi.
*FrontImageTIFF
Pointer to a handle where will be returned the handle of memory buffer containing the front
side image of the requested document, in TIFF format. If this parameter is set to NULL the
images will not returned.
*SizeFrontImageTIFF
Pointer to an integer where will be returned the size of the Front image in TIFF format.
*pRearImageTIFF
Pointer to a handle where will be returned the handle of memory buffer containing the rear
side image of the requested document, in TIFF format. If this parameter is set to NULL the
images will not returned.
*SizeRearImageTIFF
Pointer to an integer where will be returned the size of the Rear image in TIFF format.
DpiImagesBMP
Specified the DPI resolution of the BMP images returned, the value accepted are :
IMAGES_RESOLUTION_100_DPI : Images at 100 dpi.
IMAGES_RESOLUTION_200_DPI : Images at 200 dpi.
IMAGES_RESOLUTION_300_DPI : Images at 300 dpi.
*FrontImageBMP
Pointer to a handle where will be returned the handle of memory buffer containing the front
side image of the requested document, in DIB format. If this parameter is set to NULL the
images will not returned.
CodelineSW
This field will return the codeline data read using the software interpretation algorithm.
CodelineHW
This field will return the codeline data read using the MICR reader . This buffer will be filled
also in case Magnetic and Optical is requested.
Barcode
This field will return the barcode codeline data, either PDF417 or 2_OF_5, read using the
barcode reader.
*NrPrinted
Variable where it will be returned the progressive count number physically endorsed on the
documents. A previous LSLoadStringWithCounterEx() call has to be done.
*Reserved1
Reserved for future use. Must be set to NULL.
*Reserved2
Reserved for future use. Must be set to NULL.
*Reserved3
Reserved for future use. Must be set to NULL.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_PAPER_JAM
LS_INVALID_COMMAND
LS_FEEDER_EMPTY
LS_DOUBLE_LEAFING_WARNING
LS_DOUBLE_LEAFING_ERROR
LS_LOOP_INTERRUPTED
LS_REPLACE_CARTRIDGE
Comments
The type of compression for the JPEG format is taken from the Quality parameter set with the
LSAutoDocHandle() call.
The function doesn’t return a resolution higher than the resolution provided in the ScanMode
parameter set with the LSAutoDocHandle() call.
The TIFF images are returned in TIFF Gr. 4 format ONLY.
The images handles retrieved by this function must be released by the application.
Description
Stop the loop of automatic documents handling started with the LSAutoDocHandle().
If you had started a loop of LSAutoDocHandle and you want to stop it, you must accept that some
documents still need to be processed before the stop is performed. The more the application is slow
in reading images and codelines, the more documents will pass before the stop is done.
Even with a very fast application which reads images as they are available, it is always possible that
in the meantime a new document is fed before the LSStopAutoDocHandle is called.
This means that the stop is not istantaneous.
The documents already present in the path at the time of the LSSTopAutoDocHandle() are moved
up to the sorter.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Return Value
LS_OKAY
LS_OPEN_NOT_DONE
Comments
Remember to call the function LSGetDocData() until the reply is different from LS_OKAY, otherwise
the unit remain in a pending state.
There are two different ways of working . The first one is to issue the read command and wait indefinitely for
the card insertion.
The second one is to send a read command with a given timeout, so either the command completes with the
resulting strings or with a timeout error.
Make sure to work with the magnetic stripe commands only if no other commands are outstanding to the
device. No more than one outstanding command can be issued to the device at the same time.
If you issued a magnetic stripe reading command and you want to cancel it, you can call a LSResetEx()
function with the ResetType parameter set to RESET_ERROR from a parallel thread.
Description
This command may be used with LS devices equipped with a magnetic stripe card reader.
The function terminate when one of the following events occur :
A badge is read or the function LSReset() is called.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Format
Specifies which track(s) to read. Accepted values are :
FORMAT_IATA = IATA, usually associated to track 1
FORMAT_ABA = ABA, usually associated to track 2
FORMAT_MINTS = MINTS, usually associated to track 3
FORMAT_IATA_ABA = IATA + ABA, both tracks 1 and 2
FORMAT_ABA_MINTS = ABA + MINTS, both tracks 2 and 3
FORMAT_IATA _ABA_MINTS = IATA + ABA + MINTS, tracks 1, 2 and 3
MaxLength
Length of the buffer where data read from the card will be returned.
String
Buffer where data read from the card will be returned.
Length
Length of the data returned in string.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_DATA_TRUNCATED
Comments
The start of data of each of the card tracks read will be identified by a leading ASCII character 't' .
Description
This command may be used with LS devices equipped with a magnetic stripe card reader.
Reads badge traces, the difference with the LSReadBadge() is the timeout associated.
The function terminate when one of the following events occur :
A badge is read or the timeout is expired or the function LSReset() is called.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Format
FORMAT_IATA = IATA
FORMAT_ABA = ABA
FORMAT_MINTS = MINTS
FORMAT_IATA_ABA = IATA + ABA
FORMAT_ABA_MINTS = ABA + MINTS
FORMAT_IATA_ABA_MINTS = IATA + ABA + MINTS
MaxLength
Length of buffer where data read from badge will be returned.
String
Buffer where data read from badge will be returned.
Length
Length of data read from badge.
Timeout
Timeout value expressed in milliseconds, this parameter accept as minimum value
MIN_TIMEOUT (500 ms).
Return Value
LS_OKAY
LS_SERVERSYSERR
LS_USBERR
LS_PERIFNOTFOUND
LS_HARDERR
LS_PERIFOFFON
LS_INVALID_TYPE_CMD
Comments
The traces string returned start with the character 't'.
In order to cancel a LSReadBadgeWithTimeout() function execution, call the LSReset() function.
In some cases the function requires the user to provide the window coordinates for the decoding. In other
cases (like for instance with the barcode) the engine itself is able to locate the correct window and decode it.
The following support libraries are needed in case you want the availability of the Software Read Codelines
functions:
CtsDecod.dll
BarDecode.dll
CtsPDF.dll
CtsPdfDriverLicenze.dll
CtsDataMatrix.dll
CtsQRCode.dll
CtsMicroHole.dll
CtsBarcodeLocate.dll
CtsRS.dll
RotateImagelib.dll
Description
This function should be used to read the codeline data by means of software decoding. In this case
the codeline may be located anywhere in the document.
At present the decoding engine works only on bitmaps of 100, 200 or 300 dpi.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hImage
Handle of the scanned image, in DIB format, from which to read the codeline.
CodelineType
Specify the type of codeline font to read and decode. The coordinates’ starting point is the
bottom right margin of the document.
READ_CODELINE_SW_OCRA = read codeline from the position specified by X, Y and Size
parameters.
READ_CODELINE_SW_OCRB_NUM = read codeline from the position specified by X, Y
and Size parameters.
READ_CODELINE_SW_OCRB_ALFANUM = read codeline from the position specified by
X, Y and Size parameters.
READ_CODELINE_SW_OCRB_ITALY = read codeline from the position specified by X, Y
and Size parameters. This font is a subset of the alfa-
numeric font without the character ‘&’ and same separator.
READ_CODELINE_SW_E13B = read codeline from the position specified by X, Y and Size
parameters.
READ_CODELINE_SW_CMC7 = read codeline from the position specified by X, Y and Size
parameters. The co-ordinate start from bottom right corner
of the document.
UnitMeasure
Specify whether the Start_X, Start_Y, SizeW and SizeH measures are expressed in
millimeters or in inches.
The possible values are either UNIT_MM or UNIT_INCH.
Start_X
Specify the x co-ordinate from right hand margin of the document. The value must be
consistent with the UnitMeasure.
SizeW
Specify the width of the window on the image bitmap that will be processed by the decoding
software. The value must be consistent with the UnitMeasure.
SizeH
Specify the height of the window on the image bitmap that will be processed by the decoding
software.
CodelineOpt
Pointer to a structure of type READOPTIONS (refer to Comments ) that contains further
options for codeline decoding.
Codeline
Pointer to the user buffer where the decoded codeline data will be copied.
If the parameter CodelineType is set to READ_CODELINE_SW_OCRA the data will start
with a leading ASCII character ‘A’.
Length
Pointer to a variable that in input specifies the size of the buffer supplied by the application
and pointed by Codeline parameter, and in output will specify the actual number of returned
characters.
Return Value
LS_OKAY
LS_NO_LIBRARY_LOAD
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_INVALID_CODELINE_TYPE
LS_UNIT
LS_MISSING_IMAGE
LS_INVALID_SIZEH_VALUE
LS_OPEN_NOT_DONE
LS_DECODE_FONT_NOT_PRESENT
LS_DECODE_INVALID_COORDINATE
LS_DECODE_INVALID_OPTION
LS_DECODE_INVALID_CODELINE_TYPE
LS_DECODE_SYSTEM_ERROR
LS_DECODE_DATA_TRUNC
LS_DECODE_INVALID_BITMAP
LS_DECODE_ILLEGAL_USE
PutBanks
When equal to TRUE causes the addition of a space character between different parts of
codeline data. When equal to FALSE no space character is added.
TypeRead
To decode only one type of font the parameter must be set to
READ_ONE_CODELINE_TYPE.
To decode a codeline E13B x OCRB the parameter must be to set
READ_CODELINE_SW_E13B_X_OCRB and the parameter CodelineType of the function
must be set to :
CodelineType[0] = READ_CODELINE_SW_E13B
CodelineType[1] = READ_CODELINE_SW_OCRB_NUM
CodelineType[2] = ‘\0’
Width X
Description
This function should be used to read barcodes 1 and 2D, by means of software decoding. In this
case the barcode may be located anywhere in the document.
For decoding barcodes 1D this function work only if Bardecode.dll is available.
For decoding barcode PDF417 this function work only if CTSPdf.dll is available.
For decoding barcode DATAMATRIX this function work only if CtsDataMatrix.dll is available.
For decoding barcode QRCODE this function work only if CtsQRCode.dll is available.
There’s also the possibility to locate the barcode in automatic mode on the given image, if the
parameters for the coordinate are all set to 0 (zero).
If on the document are present more then one barcode the function return only one barcode, in order
to get the other call the function LSGetNextBarcode().
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hImage
Handle of the 16 or 256 shades grey or color bitmap that contains the data to read.
PDF417 decode only on bitmap at 16 or 256 shades of grey, at 200 or 300 dpi types.
TypeBarcode
Type of barcode supported :
READ_BARCODE_2_OF_5 = the library decoding a 2_OF_5 barcode.
READ_BARCODE_CODE39 = the library decoding a CODE39 barcode.
READ_BARCODE_CODE128 = the library decoding a CODE128 barcode.
READ_2D_BARCODE_PDF417 = the library decoding a PDF417 barcode.
READ_2D_BARCODE_DATAMATRIX = the library decoding a DATAMATRIX barcode.
READ_2D_BARCODE_QRCODE = the library decoding a QRCode barcode.
pos_X
Specify the co-ordinate (in millimeters) from right margin of the document.
pos_Y
Specify the y position (in millimeters) from bottom margin of the document.
SizeW
Specify the width (in millimeters) of the window on the image bitmap that will be processed
by the decoding software to search for and decode the barcode.
SizeH
Specify the height (in millimeters) of the window on the image bitmap that will be processed
Codeline
Pointer to the application buffer where the interpreted barcode data will be copied.
Length
Pointer to a variable that in input specifies the size of the application buffer pointed by
Codeline parameter, and in output will specify the actual number of returned characters.
Return Value
LS_OKAY
LS_NO_LIBRARY_LOAD
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_MISSING_IMAGE
LS_INVALID_BARCODE_TYPE
LS_INVALID_COORDINATE
LS_OPEN_NOT_DONE
LS_BARCODE_GENERIC_ERROR
LS_BARCODE_NOT_DECODABLE
LS_BARCODE_OPENFILE_ERROR
LS_BARCODE_READBMP_ERROR
LS_BARCODE_MEMORY_ERROR
LS_BARCODE_START_NOTFOUND
LS_BARCODE_STOP_NOTFOUND
LS_PDF_NOT_DECODABLE
LS_PDF_READBMP_ERROR
LS_PDF_BITMAP_FORMAT_ERROR
LS_PDF_MEMORY_ERROR
LS_PDF_START_NOTFOUND
LS_PDF_STOP_NOTFOUND
LS_PDF_LEFTIND_ERROR
LS_PDF_RIGHTIND_ERROR
LS_PDF_OPENFILE_ERROR
Comments
Description
This function should be used to get the next barcode present on the document, re-call the function
until return the reply LS_NO_MORE_DATA.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Codeline
Pointer to the application buffer where the interpreted barcode data will be copied.
Length
Pointer to a variable that in input specifies the size of the application buffer pointed by
Codeline parameter, and in output will specify the actual number of returned characters.
Return Value
LS_OKAY
LS_NO_LIBRARY_LOAD
LS_NO_MORE_DATA
LS_OPEN_NOT_DONE
Comments
Description
Used to read Micro Holes codelines present on the front and/or rear of the document, by means of
software decoding.
At the moment this function doesn’t verify the true hole.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hImageFront
Handle of the scanned front image, in DIB format, that contains the data to read.
hImageRear
Handle of the scanned rear image, in DIB format, that contains the data to read.
If not available set to NULL
Reserved
Not used, set to FALSE.
UnitMeasure
Specify whether the Start_X, Start_Y, SizeW and SizeH measures are expressed in
millimeters or in inches.
The possible values are either UNIT_MM or UNIT_INCH.
nrRegions
Number of codeline to decode.
stMicroHole
Array of struct of parameter of each region, described in Comments section.
Return Value
LS_OKAY
LS_NO_LIBRARY_LOAD
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_MISSING_IMAGE
LS_INVALID_COORDINATE
LS_OPEN_NOT_DONE
Comments
The MICROHOLE_STRUCT structure is organized as follows :
Description :
x
Specify the co-ordinate from left margin of the document.
y
Specify the co-ordinate from left margin of the document.
width
Specify the width of the window on the image bitmap that will be processed by the
decoding software.
height
Specify the height of the window on the image bitmap that will be processed by the
decoding software.
TrueHole
Return TRUE o FALSE if the holes are verified or no.
strFront
String decoded on the front image.
dimStrFront
Specify the dimension in byte of the strFront parameter.
strRear
String decoded on the rear image.
dimStrRear
Specify the dimension in byte of the strRear parameter.
Description
This function allows to read US Driver licenses . In those cards the following symbols can be
present: PDF417 (2D barcode) and/or mono-dimensional barcodes (like code 128)
Those symbols can be present in the document in all position of this.
This function is available only if the following DLLs are present: CtdPDFDriverLicense.dll and
bardecode.dll.
It is also necessary that the devices are sold with the DL option enabled.
At present the function works only on bitmaps of 300 dpi.
The output of the function will be composed of two separate strings (one for 1D and another for 2D
barcodes) . Those results can be provided as normal strings or strings coded in 64 base .
The function will also be able to provide the following information:
Whether the card was passed in the correct direction
Whether the card was passed upside down
Whether the card was passed correctly but the barcodes cannot be decoded
Whether no barcodes were found in the image provided.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hImage
Handle of the 16 shades of grey, 300 dpi bitmap that contains the data to be read. (not
advised)
Handle of the 256 shades of grey, 300 dpi bitmap that contain the data to be read.
Handle of color, 300 dpi bitmap that contain the data to be read.
encodeBase
Possible values:
ENCODE_NO
ENCODE_BASE_64
Codeline_2D
Pointer to the user buffer where the decoded 2D barcode data will be copied.
Length_2D
Pointer to a variable that in input specifies the size of the buffer supplied by the application
and pointed by Codeline_2D parameter, and in output will specify the actual number of
ErrorRate
It returns the number of characters corrected by the decoding algorithm.
TypeBarcode_1D
It specifies the type of 1D barcode to be read. Possible values:
READ_BARCODE_2_OF_5
READ_BARCODE_CODE39
READ_BARCODE_CODE128 (default)
Codeline_1D
Pointer to the user buffer where the decoded 1D barcode data will be copied.
Length_1D
Pointer to a variable that in input specifies the size of the buffer supplied by the application
and pointed by Codeline_1D parameter, and in output will specify the actual number of
returned characters. In case the card does not include 1D barcodes, the Length value
returned is 0.
Reserved1
Reserved for future improvement, must be set to NULL.
Reserved2
Reserved for future improvement, must be set to NULL.
Reserved3
Reserved for future improvement, must be set to NULL.
Reserved4
Reserved for future improvement, must be set to NULL.
Return Value
LS_OKAY
LS_NO_LIBRARY_LOAD
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_MISSING_IMAGE
LS_OPEN_NOT_DONE
LS_PDF_NOT_DECODABLE
LS_PDF_READBMP_ERROR
LS_PDF_BITMAP_FORMAT_ERROR
LS_PDF_MEMORY_ERROR
LS_PDF_START_NOTFOUND
LS_PDF_STOP_NOTFOUND
LS_PDF_LEFTIND_ERROR
LS_PDF_RIGHTIND_ERROR
LS_PDF_OPENFILE_ERROR
LS_PDF_LOCALIZATION_ERROR
LS_PDF_TOO_MANY_ERROR
Comments
Output of the function will be if the barcode :
LS_OKAY: in this case the image passed to the function includes the barcodes (rear side). The
LSSaveJPEG
LSSaveDIB
LSSaveTIFFEx
LSDisplayImage
LSUpdateImage
LSConvertImageToBW
LSConvertToJPEG
LSConvertToTIFF
LSEnableImageCorrection
LSFreeImage
LSRotateImage
LSConvertImage200To100dpi
LSImageBrightness
LSImageContrast
LSCutImage
NOTE: although Windows allows users to create pathnames longer than this, there is the limitation that the
pathname of the file to be saved with CTS Image manipulation functions cannot exceed 128 bytes.
Description
This function allows to save the scanned image in JPEG format.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hImage
Handle of the image to save in JPEG format.
Quality
Indicates the relationship between quality and compression range 2 to 255 that :
2 = max quality.
255 = max compression.
Filename
Full pathname of the file where the image will be saved. (max 128)
Return Value
LS_OKAY
LS_OPEN_NOT_DONE
LS_NO_LIBRARY_LOAD
LS_INVALID_QUALITY
LS_MISSING_IMAGE
LS_JPEG_ERROR
Comments
Description
This function allows to save the scanned image in TIF format (included TIFF_JPEG).
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hImage
Handle of the image to save in TIF format.
Filename
Name of the file where the image will be saved. (max 128)
Type
Specify the TIF format
FILE_TIF = Tagged Image File Format
SAVE_TIF_JPEG = Image TIFF saved in JPEG format.
FILE_CCITT = TIFF CCITT, only b/w image
FILE_CCITT_GROUP3_1DIM = CCITT Group3 one dimension, only b/w image
FILE_CCITT_GROUP3_2DIM = CCITT Group3 two dimensions, only b/w image
FILE_CCITT_GROUP4 = CCITT Group4 two dimensions, only b/w image.
Quality
Valid only with the parameter Type set to SAVE_TIF_JPEG, indicates the relationship
between quality and compression range 2 to 255 that :
2 = max quality.
255 = max compression.
SaveMode
SAVE_OVERWRITE = Overwrite the file.
SAVE_APPEND = Append the image in a multi-page image file.
SAVE_REPLACE = Replace a image in a multi-page image file.
SAVE_INSERT = Insert the image in a multi-page image file.
PageNumber
Number indicating the position in a multi-page file.
Return Value
LS_OKAY
LS_OPEN_NOT_DONE
LS_MISSING_IMAGE
Comments
Description
This function allows to save the scanned image in Bitmap format.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hImage
Handle of the image to save in BMP format.
Filename
Name of the file where the image will be saved. (max 128)
Return Value
LS_OKAY
LS_OPEN_NOT_DONE
LS_BMP_ERROR
Comments
Description
This function allows to convert the scanned image in JPEG format in a memory buffer.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hImage
Handle of the BMP image to convert in JPEG format.
Quality
Indicates the relationship between quality and compression range 2 to 255 that :
2 = max quality.
255 = max compression.
JpegImage
Pointer to a handle where will be returned the handle of a memory buffer containing the
converted image in JPEG format.
ImageSize
Pointer to a variable where will be returned the size of the converted image.
Return Value
LS_OKAY
LS_OPEN_NOT_DONE
LS_NO_LIBRARY_LOAD
LS_INVALID_QUALITY
LS_MISSING_IMAGE
LS_JPEG_ERROR
Comments
The image (in BMP format) to be converted must be supplied by the application. The JPEG image
returned by this function must be released by the application using the LSFreeImage function.
Description
This function allows to convert the scanned image in TIF format in a memory buffer.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hImage
Handle of the image to be converted in TIF format.
Type
Specify the TIF format
FILE_TIF = Tagged Image File Format
SAVE_TIF_JPEG = Image TIFF saved in JPEG format.
FILE_CCITT = TIFF CCITT, only b/w image
FILE_CCITT_GROUP3_1DIM = CCITT Group3 one dimension, only b/w image
FILE_CCITT_GROUP3_2DIM = CCITT Group3 two dimensions, only b/w image
FILE_CCITT_GROUP4 = CCITT Group4 two dimensions, only b/w image.
Quality
Valid only with the parameter Type set to SAVE_TIF_JPEG, indicates the relationship
between quality and compression range 2 to 255 that :
2 = max quality.
255 = max compression.
SaveMode
SAVE_OVERWRITE = Overwrite the file.
SAVE_APPEND = Append the image in a multi-page image file.
SAVE_REPLACE = Replace a image in a multi-page image file.
SAVE_INSERT = Insert the image in a multi-page image file.
PageNumber
Number indicating the position in a multi-page file.
TiffImage
Pointer to a handle where will be returned the handle of a memory buffer containing the
converted image in TIFF format.
ImageSize
Pointer to a variable where will be returned the size of the converted image.
Comments
The image (in BMP format) to be converted must be supplied by the application. The TIFF image
returned by this function must be released by the application using the LSFreeImage function.
Description
This function can be used by client application to convert an image from 16 or 256 shades of grey to
black and white.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Method
Specify the conversion algorithm to apply :
ALGORITHM_CTS : Use a proprietary CTS algorithm.
ALGORITHM_CTS_2 : Use a proprietary CTS algorithm.
ALGORITHM_CTS_3 : Use a proprietary CTS algorithm.
ALGORITHM_CTS_TOP_IMAGE : Use a proprietary CTS algorithm, need CtsTopImage.dll
library.
ALGORITHM_CTS_IMAGE_PRO : Use a proprietary CTS algorithm, need CtsImagePro.dll
library.
ALGORITHM_CTS_CLEAR_PIX : Use a proprietary CTS algorithm, need CtsCLearPIX.dll
library.
ALGORITHM_NODITHERING : Use nearest color matching.
ALGORITHM_FLOYDSTEINDITHERING : Use Floyd-Steinberg dithering.
ALGORITHM_STUCKIDITHERING : Use Stucki dithering.
ALGORITHM_BURKESDITHERING : Use Burkes dithering.
ALGORITHM_SIERRADITHERING : Use Sierra dithering.
ALGORITHM_STEVENSONARCEDITHERING : Use Stevenson Arce dithering.
ALGORITHM_JARVISDITHERING : Use Jarvis dithering.
GrayImage
Handle of memory buffer containing an image, in DIB format, supplied by the application for
conversion. The handle of the converted image will be returned into BwImage.
BwImage
Pointer to a handle where will be returned the handle of a memory buffer containing the
converted b/w image of the document, in DIB format.
Parameter1
This parameter is related to the Method parameter.
When Method is equal to :
ALGORITHM_CTS The valid range is from 50 to 600, the default is 450
(DEFAULT_POLO_FILTER). For documents with a clear background the
value must be in the low range (50..450), for documents with a darkened
background the value must be in the higher range (450..600).
ALGORITHM_CTS_3 The valid range is from 0 to 15, the default is 8
(DEFAULT_CTS_3_TRHESHOLD).
Return Value
LS_OKAY
LS_OPEN_NOT_DONE
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_NO_LIBRARY_LOAD
LS_INVALID_METHOD
LS_INVALID_POLO_FILTER
Comments
The grey scale image (in DIB format) to be converted must be supplied by the application. The BW
image returned by this function must be released by the application using the LSFreeImage
function. This function can be used only after a successful LSConnect.
Description
This function can be used by client application to convert an image from 16 or 256 shades of grey to
black and white. In output the function return some parameters which can be used by the application
to evaluate the characteristics of the resulting bitonal image.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Method
Specify the conversion algorithm to apply :
ALGORITHM_CTS : Use a proprietary CTS algorithm.
ALGORITHM_CTS_2 : Use a proprietary CTS algorithm.
ALGORITHM_CTS_3 : Use a proprietary CTS algorithm.
ALGORITHM_CTS_TOP_IMAGE : Use a proprietary CTS algorithm, need CtsTopImage.dll
library.
ALGORITHM_CTS_IMAGE_PRO : Use a proprietary CTS algorithm, need CtsImagePro.dll
library.
ALGORITHM_CTS_CLEAR_PIX : Use a proprietary CTS algorithm, need CtsClearPIX.dll
library.
ALGORITHM_NODITHERING : Use nearest color matching.
ALGORITHM_FLOYDSTEINDITHERING : Use Floyd-Steinberg dithering.
ALGORITHM_STUCKIDITHERING : Use Stucki dithering.
ALGORITHM_BURKESDITHERING : Use Burkes dithering.
ALGORITHM_SIERRADITHERING : Use Sierra dithering.
ALGORITHM_STEVENSONARCEDITHERING : Use Stevenson Arce dithering.
ALGORITHM_JARVISDITHERING : Use Jarvis dithering.
GrayImage
Handle of memory buffer containing an image, in DIB format, supplied by the application for
conversion. The handle of the converted image will be returned into BwImage.
BwImage
Pointer to a handle where will be returned the handle of a memory buffer containing the
converted b/w image of the document, in DIB format.
Parameter1
This parameter is related to the Method parameter.
When Method is equal to :
ALGORITHM_CTS The valid range is from 50 to 600, the default is 450
Threshold
This parameter is meaningful only if ALGORITHM_CTS is chosen as Method. The valid
range is from 0.50 to 1.
The default value when this parameter is set to 0 is 0.90.
histogram
Pointer to an array of 16 or 256 intergers values where it will be returned the number of
pixels found for each gray level.
Noise
Pointer to an integer where it will be returned the number of spots 2x2 found after the
convertion.
WhitePixel
Pointer to an integer where it will be returned the total number of white pixels present in the
bitmap after the convertion.
BlackPixel
Pointer to an integer where it will be returned the total number of black pixels present in the
bitmap after the convertion.
Return Value
LS_OKAY
LS_OPEN_NOT_DONE
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_NO_LIBRARY_LOAD
LS_INVALID_METHOD
LS_INVALID_POLO_FILTER
Comments
The grey scale image (in DIB format) to be converted must be supplied by the application. The BW
image returned by this function must be released by the application using the LSFreeImage
function. This function can be used only after a successful LSConnect.
Description
The function set the Method and the threshold used to convert the images to BW from the functions
LSAutoDocHandle() and LSDocHandle() when the parameter ScanMode is set to
SCAN_MODE_BW. The method and threshold value is used in the CTS Black and White convertion
algorithm which is used by default.
If this function is not explicity called from the application the BW convertion is done with method =
ALGORITHM_CTS and Threshold = 450.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Method
The valid value are :
ALGORITHM_CTS : Use a proprietary CTS algorithm. (Set by default)
ALGORITHM_CTS_3 : Use a proprietary CTS algorithm.
ALGORITHM_CTS_TOP_IMAGE : Use a proprietary CTS algorithm, need CtsTopImage.dll
library.
ALGORITHM_CTS_IMAGE_PRO : Use a proprietary CTS algorithm, need CtsImagePro.dll
library.
ALGORITHM_CTS_CLEAR_PIX : Use a proprietary CTS algorithm, need CtsClearPIX.dll
library.
Threshold
This parameter is related to the Method parameter.
When Method is equal to :
ALGORITHM_CTS The valid range is from 50 to 600, the default is 450
(DEFAULT_POLO_FILTER). For documents with a clear background the
value must be in the low range (50..450), for documents with a darkened
background the value must be in the higher range (450..600).
ALGORITHM_CTS_3 The valid range is from 0 to 15, the default is 8.
Reserved
Reserved for future improvement, must be set to NULL.
Return Value
LS_OKAY
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
LS_INVALID_THRESHOLD
Description
Convert a BW, grey or color image from 100, 200 or 300 dpi to another requested resolution.
Parameters
hWnd
Handle of the application windows which will receive the notification messages. (Reserved
for future use)
hImage
Handle of memory buffer containing an image, in DIB format, supplied by client for
conversion. The handle of the converted image will be returned into pImage.
NewResolution
Resolution required.
pImage
Pointer to a handle where will be returned the handle of memory buffer containing the
converted image of the document in DIB format.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
LS_MISSING_IMAGE
LS_RESIZE_ERROR
Comments
The image returned from this function must be released by the application with
LsFreeImage() function.
Description
Convert a color image to 256 gray.
Parameters
hWnd
Handle of the application windows which will receive the notification messages. (Reserved
for future use)
hImage
Handle of memory buffer containing an image, in DIB format, supplied by client for
conversion. The handle of the converted image will be returned into pImage.
pImage
Pointer to a handle where will be returned the handle of memory buffer containing the
converted image of the document in DIB format.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
LS_MISSING_IMAGE
Comments
This function can be used by client application to convert a color image to gray image. The color
scale image (in DIB format) to be converted must be supplied by the application. The image
returned from this function must be released by the application with LsFreeImage() function.
Description
Convert a image of 256 gray to 16 gray scale.
Parameters
hWnd
Handle of the application windows which will receive the notification messages. (Reserved
for future use)
hImage
Handle of memory buffer containing an image, in DIB format, supplied by client for
conversion. The handle of the converted image will be returned into pImage.
pImage
Pointer to a handle where will be returned the handle of memory buffer containing the
converted image of the document in DIB format.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
LS_MISSING_IMAGE
Comments
This function can be used by client application to convert a 256 gray image to 16 gray image. The
256 gray scale image (in DIB format) to be converted must be supplied by the application. The
image returned from this function must be released by the application with LsFreeImage()
function.
Description
This function either enables or disables a software filter used to give a lighter rendering of the
scanned image.
Parameters
hWnd
Handle of the application windows which will receive the notification messages.
fDo
TRUE enable the filter
FALSE disable the filter.
Return Value
LS_OKAY
LS_OPEN_NOT_DONE
Comments
The filter is disabled by default.
Description
Free memory allocated by LSReadImage(), LS_ReadImagePiece(), LSGetDocData(),
LSConvertImageToBW(),LSConvertImage200To100dpi, LSRotateImage, LSImageBrightness,
LSImageContrast, LSCutImage functions.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hImage
Pointer to handle of image to be released.
Return Value
LS_OKAY
LS_INVALID_HANDLE
LS_NO_LIBRARY_LOAD
Comments
Use this function also to release all image memory returned from the APIs function.
Description
The function returns a copy of the image passed in input rotated by the specified number of degrees.
The application must free (release) the memory areas allocated for both input and output images.
Freeing one image area does not affect the other.
Parameters
hWnd
Handle of the application windows which will receive the notification messages.
hImage
Handle of the image returned by LSReadImage().
degree
Number of degrees to rotate (+/-). This can be a number from 1 to 360. A positive value will
rotate the image in a clockwise rotation, while a negative value will rotate the image in a
counter-clockwise rotation.
pImage
Pointer to a handle where will be returned the handle of the memory buffer containing the
rotated image, in DIB (BMP) format.
Return Value
LS_OKAY
LS_NO_LIBRARY_LOAD
LS_INVALID_TYPE_COMMAND
LS_EXECCMD
LS_CMDSEQUENCEERROR
LS_INVALID_DEGREE
LS_MISSING_IMAGE
LS_OPEN_NOT_DONE
Comments
The memory areas allocated for both images must be released with the function LSFreeImage().
Description
The function changes the intensity (brightness) of the image in a bitmap, it returns a copy of the
given image.
Parameters
hWnd
Handle of the application windows which will receive the notification messages.
hImage
Handle of the image returned from LSReadImage().
nChange
Amount to change the intensity. The intensity ranges from -1000 to 1000. A positive value
increases (or lightens) the brightness of the bitmap image. A negative values decreases (or
darkens) the brightness of the bitmap image.
hNewImage
Pointer to a handle where will be returned the handle of the memory buffer containing the
image modified in DIB format.
Return Value
LS_OKAY
LS_NO_LIBRARY_LOAD
LS_INVALID_TYPE_COMMAND
LS_EXECCMD
LS_CMDSEQUENCEERROR
LS_INVALID_NCHANGE
LS_MISSING_IMAGE
LS_OPEN_NOT_DONE
LS_BRIGHTNESS_ERROR
Comments
The images must be free with the function LSFreeImage().
Description
The function increases or decreases the contrast of the image in a bitmap, it return a copy of the
given image.
Parameters
hWnd
Handle of the application windows which will receive the notification messages.
hImage
Handle of the image returned from LSReadImage().
nChange
Amount of contrast change. The contrast ranges from -1000 to 1000. A positive value
increases the contrast of the bitmap image. A negative values decreases the contrast of the
bitmap image.
hNewImage
Pointer to a handle where will be returned the handle of the memory buffer containing the
image modified in DIB format.
Return Value
LS_OKAY
LS_NO_LIBRARY_LOAD
LS_INVALID_TYPE_COMMAND
LS_EXECCMD
LS_CMDSEQUENCEERROR
LS_INVALID_NCHANGE
LS_MISSING_IMAGE
LS_OPEN_NOT_DONE
LS_CONTRAST_ERROR
Comments
The images must be released with the function LSFreeImage().
Description
The function return a portion of the given image according to the rectangle provided.
Parameters
hWnd
Handle of the application windows which will receive the notification messages.
hImage
Handle of the image returned from LSReadImage().
UnitMeasure
Specify if the Start_X, Start_Y and SizeW measures are give in millimeter or in inch.
The values are UNIT_MM and UNIT_INCH.
Start_X
Specify the x co-ordinate from right margin of the document.
Start_Y
Specify the y co-ordinate from bottom margin of the document.
SizeW
Specify the width of the window to be cut in the document bitmap.
SizeH
Specify the height of the window to be cut in the document bitmap.
hNewImage
Pointer to a handle where will be returned the handle of the memory buffer containing the
portion of the image in DIB format.
Return Value
LS_OKAY
LS_NO_LIBRARY_LOAD
LS_INVALID_TYPE_COMMAND
LS_EXECCMD
LS_CMDSEQUENCEERROR
LS_UNIT_PARAM
LS_MISSING_IMAGE
LS_INVALID_COORDINATE
LS_OPEN_NOT_DONE
Comments
Description
This function should be used to display front and back images read from a file.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
HInstance
Handle of the application instance.
FilenameFront
Pathname of the file containing the front image to display.
FilenameBack
Pathname of the file containing the rear image to display.
Xfront
The x parameter is the initial x co-ordinate of the window's upper-left corner, in screen co-
ordinates, of the front image.
Yfront
The Y parameter is the initial Y co-ordinate of the window's upper-left corner, in screen co-
ordinates of the front image.
Xback
The x parameter is the initial x co-ordinate of the window's upper-left corner, in screen co-
ordinates of the back image.
Yback
The Y parameter is the initial Y co-ordinate of the window's upper-left corner, in screen co-
ordinates of the back image.
FrontWidth
Width of front image.
FrontHeight
BackWidth
Width of back image.
BackHeight
Height of back image.
RetHwndFront
Handle of the new window that contain the front image.
RetHwndBack
Handle of the new window that contain the back image.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_INVALID_COMMAND
LS_NO_LIBRARY_LOAD
LS_INVALID_HANDLE
Comments
Description
This function displays front and back images read from file. It must be used after a
LSDisplayImage command.
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
FilenameFront
Pathname of the front image to display.
FilenameBack
Pathname of the back image to display.
RetHwndFront
Handle of the window that contain the new front image.
RetHwndBack
Handle of the window that contain the new back image.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_INVALID_COMMAND
LS_NO_LIBRARY_LOAD
LS_INVALID_HANDLE
Comments
The documents must be handled with the usual functions described in the Basic functions and in the
Advanced Documents handling sections of this manual.
The device returns per each scanned document two different images:
The application can also request a third image which is the combination of the grey scale image + the UV
image. This is done via API with the LSMergeImageGrayAndUV() function.
Before feeding the documents, the application can set some parameters for the UV.
This is done with the LSModifyPWMUltraViolet() function where it is possible to change the following :
1. increase or decrease the UV intensity light from the standard calibration of the device (in
percentage). This is particularly useful in checks that for example have a very low intensity in the UV
ink.
2. set the device in such a way that it gives a lower contrast mantaining part of the background of the
check. In alternative it can be set in such a way that the background is completely removed, only the
UV ink is captured and the resulting image has only two values: light pixels values for the UV and
black pixels where there is not presence of UV ink. In this way of working the application can make
use of the LSMergeImageGrayAndUV() function to get a combination of grey scale + UV image to
get an image which can be displayed or visually analyzed.
The UV image obtained by the scanner can also be converted in bitonal vi athe function
LSConvertUVtoBWEx()
This function allows you to specify whether the UV patterns have to be represented in the bitmap in white or
in black color.
Description
Available only for the LS150 model.
Modify the default PWM value optained with the scanner Ultra Violet calibration.
When the unit is powered off and on the PWM value is set to the original value set with the
calibration procedure of the scanner.
This function can be used to increase or decrease the UV intensity light and also to set two different
way of working: one returns the UV image with a high contrast, while the other option gives a lower
contrast keeping part of the background of the check.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
PWMValue
Modify the value of PWM in percentage, the range acceptable is from 1 to 200, the value of
100 set the value obtained with the calibration.
HighContrast
Exalt the contrast between the normal and the ultra violet ink.
Reserved
Reserved for future use, must be set to NULL.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_HARDWARE_ERROR
LS_INVALID_PWM_VALUE
Comments
Description
Merge the two image given in input.
Parameters
hWnd
Handle of the application windows which will receive the notification messages. (Reserved
for future use)
hImageGray
Handle of memory buffer containing a gray scale image at 256 colors returned from the
device to be merged with the UV image.
hImageUV
Handle of memory buffer containing a Ultra Violet image at 256 colors returned from the
device for merged.
Reserved1
Reserved for future use. Must be set to NULL.
Reserved2
Reserved for future use. Must be set to NULL.
pImage
Pointer to a handle where will be returned the handle of memory buffer containing the
merged image of the document in DIB format.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
LS_MISSING_IMAGE
LS_IMAGE_NOT_256_COLOR
Comments
This function can be used by client application to merge a Gray image with to Ultra Violet image. The
gray and the Ultra Violet images (in DIB format) to be mergered must be supplied by the application.
The image returned from this function must be released by the application with LsFree
function.
Description
Merge the two image given in input.
Parameters
hWnd
Handle of the application windows which will receive the notification messages. (Reserved
for future use)
hImageColor
Handle of memory buffer containing a color scale image returned from the device to be
merged with the UV image.
hImageUV
Handle of memory buffer containing a Ultra Violet image at 256 colors returned from the
device for merged.
Reserved1
Reserved for future use. Must be set to NULL.
Reserved2
Reserved for future use. Must be set to NULL.
pImage
Pointer to a handle where will be returned the handle of memory buffer containing the
merged image of the document in DIB format.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
LS_MISSING_IMAGE
LS_INVALID_BIT_DEPTH
Comments
This function can be used by client application to merge a Corol image with to Ultra Violet image.
The color and the Ultra Violet images (in DIB format) to be mergered must be supplied by the
application. The image returned from this function must be released by the application with
LsFree function.
Description
Convert the image UV in bitonal.
Parameters
hWnd
Handle of the application windows which will receive the notification messages. (Reserved
for future use)
hImageGray
Not used set to NULL.
Future enanchement - Handle of memory buffer containing a gray scale image at 256 colors
returned from the device.
hImageUV
Handle of memory buffer containing a Ultra Violet image at 256 color, returned from the
device.
Reserved1
Reserved for future use. Must be set to NULL.
Reserved2
Reserved for future use. Must be set to NULL.
UVImageType
The accepted values are :
UV_IMAGE_NORMAL : Return the image with UV in white on a black background. (default)
UV_IMAGE_REVERSE : Return the image with UV in black on a white background.
pImage
Pointer to a handle where will be returned the handle of memory buffer containing the image
binarizated in DIB format.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
LS_MISSING_IMAGE
LS_IMAGE_NOT_256_COLOR
Comments
The image returned from this function must be released by the application with LsFree
Description
Prints a digital invalidation string, in a given image (in BMP format)
Parameters
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
hImage
Handle of the scanned image, in DIB format, where to print the invalidation String.
String
Invalidation string.
Length
Length of the string give in the String parameter.
fontName
Name of the window font selected.
fontSize
Size of the character font.
bold
Set character Bold stile.
TRUE = Stile selected.
FALSE = Stile unselected
italic
Set character Italic stile.
TRUE = Stile selected.
FALSE = Stile unselected
underline
Set character Underline stile.
TRUE = Stile selected.
FALSE = Stile unselected
UnitMeasure
Specify whether the pos_x, and pos_y measures are expressed in millimeters or in inches.
The possible values are either UNIT_MM or UNIT_INCH.
pos_x
Specify the x co-ordinate from left margin of the document. The value must be consistent
with the UnitMeasure.
pos_y
Specify the y co-ordinate from top margin of the document. The value must be consistent
with the UnitMeasure.
Return Value
LS_OKAY
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
LS_SYSTEM_ERROR
LS_INVALID_UNIT
Comments
Description
Loads the digital invalidation string, which may be printed onto the front and/or rear side of the
document. It is possible to specify a starting number that will be automatically incremented or
decremented for each new document. At the moment avalible only for LS150 model
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Side
Specifies which of the document’s printed sides.
SIDE_FRONT_IMAGE = Front side image
SIDE_BACK_IMAGE = Rear side image
SIDE_ALL_IMAGE = Both Front and Rear side images
String
Invalidation string having the same syntax of the C-language PRINTF function, if in the
string it is not specified the %d or %ld number, the parameter StartNumber and Step are
meaningless.
Length
Length of the string given in the String parameter.
StartNumber
Starting number used in the invalidation print numeration.
Step
When greater than zero it sets the increment step applied to StartNumber .
When less than zero it sets the decrement step applied to StartNumber .
fontName
fontSize
Size of the character font.
bold
Set character Bold stile.
TRUE = Stile selected.
FALSE = Stile unselected
italic
Set character Italic stile.
TRUE = Stile selected.
FALSE = Stile unselected
underline
Set character Underline stile.
TRUE = Stile selected.
FALSE = Stile unselected
TextColor
Gray tone of the character printed, the range value is from 0 (black) to 255 (white).
UnitMeasure
Specify whether the pos_x, and pos_y measures are expressed in millimeters or in inches.
The possible values are either UNIT_MM or UNIT_INCH.
pos_x
Specify the x co-ordinate from left margin of the document. The value must be consistent
with the UnitMeasure.
pos_y
Specify the y co-ordinate from top margin of the document. The value must be consistent
with the UnitMeasure.
Return Value
LS_OKAY
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_OPEN_NOT_DONE
LS_SYSTEM_ERROR
LS_INVALID_SIDE
LS_INVALID_UNIT
Comments
This is achieved with encrypted HASH codes which are inserted inside the image.
The image in any case can be visible with normal imaging tools.
At the moment the signature is done only in JPEG and TIFF Gr.4 images.
Description
Set a User Key to protect the images returned from the unit from alterations.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
Key
A sequence of hexadecimal bytes.
If the first 3 bytes are set to zero, the key and the check are disabled.
Max Key length is LEN_SIGNATURE_KEY.
lenKey
Length in bit of the Key, value accepted :
KEY_LENGHT_128
KEY_LENGHT_256
KEY_LENGHT_512
fUseSerialID
Use the internal serial ID to digitally sign the image.
TRUE – Use the Serial ID.
FALSE – Not use the Serial ID.
Return Value
LS_OKAY
LS_SYSTEM_ERROR
LS_USB_ERROR
LS_PERIPHERAL_NOT_FOUND
LS_INVALID_KEY_LENGTH
Comments
Description
Check the images integrity from alterations.
Parameters
ImageFilename
Pointer at the image path filename to be checked.
Key
A sequence of hexadecimal bytes. This is the same Key used to sign the image.
lenKey
Length in bit of the Key, value accepted :
KEY_LENGHT_128
KEY_LENGHT_256
KEY_LENGHT_512
LsSerialID
Pointer to the internal serial ID of the unit that have filmed the image or NULL if the flag
fUseSerialID was set to FALSE when function LSSetSignatureKey() was called.
Return Value
LS_OKAY
LS_INVALID_KEY_LENGTH
LS_IMAGE_CORRUPTED
LS_IMAGE_NOT_SIGNED
Comments
Description
Check the images integrity from alterations.
Parameters
pImage
Pointer at the image to be checked.
lenImage
Dimension in bytes of the image.
Key
A sequence of hexadecimal bytes. This is the same Key used to sign the image.
lenKey
Length in bit of the Key, value accepted :
KEY_LENGHT_128
KEY_LENGHT_256
KEY_LENGHT_512
LsSerialID
Pointer to the internal serial ID of the unit that have filmed the image or NULL if the flag
fUseSerialID was set to FALSE when function LSSetSignatureKey() was called.
Return Value
LS_OKAY
LS_INVALID_KEY_LENGTH
LS_IMAGE_CORRUPTED
LS_IMAGE_NOT_SIGNED
Comments
Description
Store a certificate p12 in the unit flash.
For now available only for the LS40 and LS100 model.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
pCertificate
Pointer at the certificate.
nrBytesCert
Dimension in bytes of the certificate.
Return Value
LS_OKAY
LS_INVALID_PARAMETER
Comments
Description
Get a certificate p12 stored in the unit flash.
For now available only for the LS40 and LS100 model.
Parameters
hConnect
Handle returned by LSConnect
hWnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
pCertificate
Pointer at the buffer where will be returned the certificate.
nrBytesCert
Dimension in bytes of the certificate.
Return Value
LS_OKAY
LS_INVALID_PARAMETER
Comments
The standard DLL delivered in the base package can trace into a file if a folder named CtsTrace is created.
This folder must be created in the same folder as where the LsApi and the program are, and must have write
rights for the user.
LsApi, when loaded, write a file when the folder is present named LsApiTrace.txt
The log files reach a maximum 4Mb bytes of size. When this happens the current file is saved with old
extension and a new file is created.
Latest LsApi versions (from 1.1.0.4 on) are also able to create tracefiles per transaction if the folder
CtsTrace_batch is created.
Files named LsApiTrace_xxxxxxxxxx.txt (where xxxxxxxxxx is a timing reference) will be created.
ATTENTION: in this mode you must make sure to delete the files or remove the CtsTrace_batch folder
otherwise your hard disk will become full.
It is possible to create a tracefile in a path which is defined by the user in LsApi.ini file in Logging section.
This logs modality work as the batch trace.
Description
This function causes the drawing of a red rectangle around the document area that will be OCR
decoded with the function LSCodelineReadFromBitmap().
Parameters
hwnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
fView
TRUE = enable the drawing of the rectangle.
FLASE = disable the drawing of the rectangle.
Return Value
LS_OKAY
Comments
Description
The function send the new firmware at the peripheral, one item for time.
Parameters
hConnect
Handle returned by LSConnect
Hwnd
Handle of the application windows which will receive the notification messages (Reserved
for future use).
FileFw
Full pathname of the file that contains the firmware to download.
(*userfunc1)(char *Item)
Address of an application defined call-back function that will get in Item the same string of
firmware code sent to the device. This mechanism is provided for download monitoring
purpose from the application.
This parameter can be also set to NULL.
Return Value
LS_OKAY
LS_COMMAND_IN_EXECUTION_YET
LS_COMMAND_SEQUENCE_ERROR
LS_MISSING_FILENAME
LS_OPEN_NOT_DONE
LS_OPEN_FILE_ERROR_OR_NOT_FOUND
Comments
Note :
LSIdentify allows the application to get specific information about device configuration and capabilities.
Document handling functions must be used only inside a document handling session.
To release the image memory allocated by the service use LSFreeImage.
LSConvertImageToBW can be used only for manual document handling.
To use LSSaveJpeg, LSDisplayImage, LSUpdateImage it is necessary to install the complete
software distribution kit.
ATTENTION :
When the application calls LSConnect, the LS service tries to load the additional module IMG_UTIL.DLL.
If this module is not present the service disables the use of the additional functions. If IMG_UTIL.DLL is
found then the following additional DLL’s are also required :
LFBMP13N.DLL
LFCMP13N.DLL
LFFAX13N.DLL
LTDIS13N.DLL
LTDLG13N.DLL
LTFIL13N.DLL
LTIMG13N.DLL
LTKRN13N.DLL
LTEFX13N.DLL
otherwise the system will display a "Unable to locate DLL" message box.
14.1. Sample code in C language for the LS515 extracted from LSW5
demo code.
There are two different functions, the first one is for the manual handling of documents, the second one for
the automatic one.
14.1.1. DoSingleDocHandle()
NrCheque ++;
//-----------LoadString--------------------------------------
if( (stParDocHandle.Validate == PRINT_VALIDATE) && (strlen(stParDocHandle.szValidateText)) )
{
if( strstr(stParDocHandle.szValidateText, "%d") )
Reply = LSLoadStringWithCounter(hLS,
hWnd,
(char)(stParDocHandle.PrintBold ? FORMAT_BOLD :
FORMAT_NORMAL),
stParDocHandle.szValidateText,
8,
3);
else
Reply = LSLoadString(hLS,
hWnd,
(char)(stParDocHandle.PrintBold ? FORMAT_BOLD :
FORMAT_NORMAL),
(short)strlen(stParDocHandle.szValidateText),
stParDocHandle.szValidateText);
if (Reply != LS_OKAY)
{
if (CheckReply(hWnd, Reply, "LSLoadString"))
{
X = 16;
Y = 16;
Size = -1;
//-----------DocHandle-----------------------------------
ReplyDH = LSDocHandle(hLS,
hWnd,
stParDocHandle.Stamp,
stParDocHandle.Validate,
CodelineType,
SideToFilm,
stParDocHandle.ScanMode,
(short)(stParDocHandle.LinearEntry == TRUE ? PATH_FEED :
AUTO_FEED),
stParDocHandle.Sorter,
stParDocHandle.WaitTimeout,
stParDocHandle.BeepOnError,
NULL,
0,
0);
//
// Read image and codeline
//
// free bitmaps
llCodeline = CODE_LINE_LENGTH;
len_barcode = CODE_LINE_LENGTH;
StopAfterCodeline = FALSE;
if (Reply != LS_OKAY)
{
if((Reply == LS_IMAGE_NOT_PRESENT ) &&
(stParDocHandle.Sorter == SORTER_AUTOMATIC))
{
StopAfterCodeline = TRUE;
}
else
{
if( CheckReply(hWnd, Reply, "LSReadImage"))
{
return Reply;
}
}
}
if(!StopAfterCodeline)
{
if( !stParDocHandle.ViewOnlyLastImage )
{
if( (fOptionViewImage == TRUE) && (!stParDocHandle.DoCheckCodeline) )
{
ShowCodelineAndImage(ReplyDH,
NrCheque,
stParDocHandle.Side,
(unsigned char *)BufFrontImage,
(unsigned char *)BufBackImage,
(unsigned char *)BufFrontNettoImage,
(unsigned char *)BufBackNettoImage,
BufCodelineSW,
BufCodelineHW,
BufBarcode,
"");
} // if fOptionViewImage
} // if( !stParDocHandle.ViewOnlyLastImage )
}
if(stParDocHandle.SaveImage == IMAGE_SAVE_BOTH)
{
// richiesto salvataggio file
switch(stParDocHandle.SaveFormat)
{
case SAVE_JPEG:
if( BufBackImage )
{
// build filename
sprintf(SaveFile, "%s\\%s%dBB.jpg", SAVE_DIRECTORY_IMAGE,
NAME_IMAGE, NrFileJPEG);
Reply = LSSaveJPEG(hWnd, BufBackImage, stParDocHandle.Qual,
SaveFile );
}
if( BufFrontImage )
NrFileJPEG ++;
break;
case SAVE_BMP:
if( BufBackImage )
{
// build filename
sprintf(SaveFile, "%s\\%s%dBB.bmp", SAVE_DIRECTORY_IMAGE,
NAME_IMAGE, NrFileBMP);
Reply = LSSaveDIB(hWnd, BufBackImage, SaveFile );
}
if( BufFrontImage )
{
// build filename
sprintf(SaveFile, "%s\\%s%dFF.bmp", SAVE_DIRECTORY_IMAGE,
NAME_IMAGE, NrFileBMP);
Reply = LSSaveDIB(hWnd, BufFrontImage, SaveFile );
}
NrFileBMP ++;
break;
case FILE_TIF:
case FILE_CCITT:
case FILE_CCITT_GROUP3_1DIM:
case FILE_CCITT_GROUP3_2DIM:
case FILE_CCITT_GROUP4:
if( BufBackImage )
{
// build filename
sprintf(SaveFile, "%s\\%s%dBB.tiff", SAVE_DIRECTORY_IMAGE,
NAME_IMAGE, NrFileTIFF);
Reply = LSSaveTIFF(hWnd, BufBackImage, SaveFile,
stParDocHandle.SaveFormat,SAVE_OVERWRITE,1);
}
if( BufFrontImage )
{
// build filename
sprintf(SaveFile, "%s\\%s%dFF.tiff", SAVE_DIRECTORY_IMAGE,
NAME_IMAGE, NrFileTIFF);
Reply = LSSaveTIFF(hWnd, BufFrontImage, SaveFile,
stParDocHandle.SaveFormat,SAVE_OVERWRITE, 1);
}
NrFileTIFF ++;
break;
}
}
if( Save_BufBackImage )
GlobalFree( Save_BufBackImage );
Save_BufBackImage = BufBackImage;
BufBackImage = 0;
if( Save_BufFrontNettoImage )
GlobalFree( Save_BufFrontNettoImage );
Save_BufFrontNettoImage = BufFrontNettoImage;
BufFrontNettoImage = 0;
if( Save_BufFrontImage )
GlobalFree( Save_BufFrontImage );
Save_BufFrontImage = BufFrontImage;
BufFrontImage = 0;
//save codelines
memcpy(Save_BufCodelineSW, BufCodelineSW, sizeof(Save_BufCodelineSW));
memcpy(Save_BufCodelineHW, BufCodelineHW, sizeof(Save_BufCodelineHW));
memcpy(Save_BufBarcode, BufBarcode, sizeof(Save_BufBarcode));
}
memset(CodelineRead, 0, sizeof(CodelineRead));
if( BufCodelineHW[0] )
strcpy(CodelineRead, BufCodelineHW);
else if( BufBarcode[0] )
strcpy(CodelineRead, BufBarcode);
else if( BufCodelineSW[0] )
strcpy(CodelineRead, BufCodelineSW);
//-----------LoadString--------------------------------------
if( (stParDocHandle.SorterValidate == PRINT_VALIDATE) &&
(strlen(stParDocHandle.SorterszValidateText)) )
{
Reply = LSLoadString(hLS,
hWnd,
(char)(stParDocHandle.SorterPrintBold ? FORMAT_BOLD :
FORMAT_NORMAL),
//-----------DocHandle-----------------------------------
Reply = LSDocHandle(hLS,
hWnd,
stParDocHandle.SorterStamp,
stParDocHandle.SorterValidate,
NO_READ_CODELINE,
stParDocHandle.SorterSide,
stParDocHandle.ScanMode,
PATH_FEED,
Sorter,
stParDocHandle.WaitTimeout,
stParDocHandle.BeepOnError,
NULL,
0,
0);
if( Reply != LS_OKAY )
{
if( CheckReply(hWnd, Reply, "LSDocHandle") )
{
return Reply;
}
}
//
// read image and codeline
//
if( BufBackNettoImage )
{
GlobalFree( BufBackNettoImage );
BufBackNettoImage = 0;
}
if( BufBackImage )
{
GlobalFree( BufBackImage );
BufBackImage = 0;
}
if( BufFrontNettoImage )
{
GlobalFree( BufFrontNettoImage );
BufFrontNettoImage = 0;
}
if( BufFrontImage )
{
GlobalFree( BufFrontImage );
BufFrontImage = 0;
}
if (Reply != LS_OKAY)
{
if( CheckReply(hWnd, Reply, "LSReadImage"))
{
return Reply;
}
}
}
LSReadCodelineFromBitmap(hWnd,
BufFrontImage,
(char *)&stParDocHandle.CodelineType,
X,
Y,
Size,
MAX_PIXEL_HEIGHT,
&ro,
BufCodelineSW,
(UINT *)&llCodeline);
if (Reply != LS_OKAY)
{
if( CheckReply(hWnd, Reply, "LSReadCodelineFromBitmapEx"))
{
return Reply;
}
}
}
}
} // if fOptionViewImage
if(stParDocHandle.SaveImage == IMAGE_SAVE_BOTH)
{
// richiesto salvataggio file
switch(stParDocHandle.SaveFormat)
{
case SAVE_JPEG:
if( BufBackImage )
{
// build filename
sprintf(SaveFile, "%s\\%s%dBB.jpg",
SAVE_DIRECTORY_IMAGE, NAME_IMAGE, NrFileJPEG);
Reply = LSSaveJPEG(hWnd, BufBackImage,
stParDocHandle.Qual, SaveFile );
}
if( BufFrontImage )
{
// build filename
sprintf(SaveFile, "%s\\%s%dFF.jpg",
SAVE_DIRECTORY_IMAGE, NAME_IMAGE, NrFileJPEG);
Reply = LSSaveJPEG(hWnd, BufFrontImage,
stParDocHandle.Qual, SaveFile );
}
NrFileJPEG ++;
break;
case SAVE_BMP:
if( BufBackImage )
{
// build filename
sprintf(SaveFile, "%s\\%s%dBB.bmp",
SAVE_DIRECTORY_IMAGE, NAME_IMAGE, NrFileBMP);
Reply = LSSaveDIB(hWnd, BufBackImage, SaveFile );
}
if( BufFrontImage )
{
// Costruisco nome file completo
sprintf(SaveFile, "%s\\%s%dFF.bmp",
SAVE_DIRECTORY_IMAGE, NAME_IMAGE, NrFileBMP);
Reply = LSSaveDIB(hWnd, BufFrontImage, SaveFile );
}
NrFileBMP ++;
case FILE_TIF:
case FILE_CCITT:
case FILE_CCITT_GROUP3_1DIM:
case FILE_CCITT_GROUP3_2DIM:
case FILE_CCITT_GROUP4:
if( BufBackImage )
{
// build filename
sprintf(SaveFile, "%s\\%s%dBB.tiff",
SAVE_DIRECTORY_IMAGE, NAME_IMAGE, NrFileTIFF);
Reply = LSSaveTIFF(hWnd, BufBackImage, SaveFile,
stParDocHandle.SaveFormat,SAVE_OVERWRITE,1);
}
if( BufFrontImage )
{
// build filename
sprintf(SaveFile, "%s\\%s%dFF.tiff",
SAVE_DIRECTORY_IMAGE, NAME_IMAGE, NrFileTIFF);
Reply = LSSaveTIFF(hWnd, BufFrontImage, SaveFile,
stParDocHandle.SaveFormat,SAVE_OVERWRITE, 1);
}
NrFileTIFF ++;
break;
}
}
} // if( Reply == LS_OKAY )
}
// more docs?
if( Reply == LS_OKAY )
{
if( LSPeripheralStatus(hLS, hWnd, &SenseKey, StatusByte) == LS_OKAY )
{
if( !(StatusByte[0] & FEEDER_EMPTY) )
Reply = LS_FEEDER_EMPTY;
}
}
return Reply;
} // End DoSingleDocHandle
14.1.2. DoAutoDocHandle()
char BufFrontFile[_MAX_PATH];
char BufFrontNettoFile[_MAX_PATH];
char BufBackFile[_MAX_PATH];
char BufCodelineSW[CODE_LINE_LENGTH];
char BufCodelineHW[CODE_LINE_LENGTH];
char BufBarcode[CODE_LINE_LENGTH];
READOPTIONS ro;
short len_codeline, len_barcode = CODE_LINE_LENGTH;
char WaitCom;
MSG msg;
short NumDocRemain;
short NrDocToProcess;
int ReplyFunz = 0;
short CodelineType;
char SideToFilm;
char TypeOfDecod;
char nOutGrade;
if( stParDocHandle.NumDoc )
NrDocToProcess = stParDocHandle.NumDoc;
else
NrDocToProcess = -1;
//-----------LoadString--------------------------------------
if( (stParDocHandle.Validate == PRINT_VALIDATE) && (strlen(stParDocHandle.szValidateText)))
{
if( strstr(stParDocHandle.szValidateText, "%d") )
Reply = LSLoadStringWithCounter(hLS,
hWnd,
(char)
(stParDocHandle.PrintBold ? FORMAT_BOLD : FORMAT_NORMAL),
stParDocHandle.szValidateText,
8,
3);
else
Reply = LSLoadString(hLS,
hWnd,
(char)(stParDocHandle.PrintBold ? FORMAT_BOLD :
FORMAT_NORMAL),
(short)strlen(stParDocHandle.szValidateText),
stParDocHandle.szValidateText);
if (Reply != LS_OKAY)
{
if (CheckReply(hWnd, Reply, "LSLoadString"))
{
return 0;
}
}
}
TypeOfDecod = stParDocHandle.TypeOfDecod;
TypeOfDecod -= DECODE_OCR;
}
else if( stParDocHandle.TypeOfDecod & DECODE_BARCODE )
{
CodelineType = NO_READ_CODELINE;
C_x = stParDocHandle.Barcode_Sw_x;
C_y = stParDocHandle.Barcode_Sw_y;
C_w = stParDocHandle.Barcode_Sw_w;
C_h = stParDocHandle.Barcode_Sw_h;
TypeOfDecod -= DECODE_BARCODE;
}
else if( stParDocHandle.TypeOfDecod & DECODE_PDF417 )
{
CodelineType = NO_READ_CODELINE;
TypeOfDecod -= DECODE_PDF417;
}
if( fStopLoopOnError )
BuilderParam.StopLoopOnErrorInCodeline = TRUE;
else
BuilderParam.StopLoopOnErrorInCodeline = FALSE;
//-----------AutoDocHandle-----------------------------------
BuilderParam.Beep = TRUE; //FALSE;
Reply = LSAutoDocHandle(hLS,
hWnd,
stParDocHandle.Stamp,
stParDocHandle.Validate,
CodelineType,
stParDocHandle.ScanMode,
AUTO_FEED, //(short)(stParDocHandle.LinearEntry == TRUE ? SCAN_FEED :
AUTO_FEED),
stParDocHandle.Sorter,
if (Reply != LS_OKAY)
{
if( (Reply != LS_FEEDER_EMPTY) && (Reply != LS_DOUBLE_LEAFING_WARNING) )
{
if (CheckReply(hWnd, Reply, "LSExtAutoDocHandle"))
{
return 0;
}
}
else
Reply = LS_OKAY; }
if( stParDocHandle.SaveCodeline )
{
strcpy(FullFName, PathAppl);
strcat(FullFName, FILE_CODELINE);
if( stParDocHandle.ResetFileCodeline )
fhCodeline = fopen(FullFName, "w+t");
else
fhCodeline = fopen(FullFName, "a+t");
}
if( Save_BufBackNettoImage )
{
GlobalFree( Save_BufBackNettoImage );
Save_BufBackNettoImage = 0;
}
if( Save_BufBackImage )
{
GlobalFree( Save_BufBackImage );
Save_BufBackImage = 0;
}
if( Save_BufFrontImage )
{
GlobalFree( Save_BufFrontImage );
Save_BufFrontImage = 0;
}
memset(Save_BufCodelineSW, 0, sizeof(Save_BufCodelineSW));
memset(Save_BufCodelineHW, 0, sizeof(Save_BufCodelineHW));
memset(Save_BufBarcode, 0, sizeof(Save_BufBarcode));
//-----------GetDocData--------------------------------------
if( (fOptionViewImage == TRUE) && (Reply == LS_OKAY) )
{
while( NrCheque != NrDocToProcess )
{
WaitCom = WAIT_YES;
memset(BufFrontFile, 0, sizeof(BufFrontFile));
memset(BufFrontNettoFile, 0, sizeof(BufFrontNettoFile));
memset(BufBackFile, 0, sizeof(BufBackFile));
memset(BufBackNettoFile, 0, sizeof(BufBackNettoFile));
// free bitmaps
if( BufBackNettoImage )
{
GlobalFree( BufBackNettoImage );
BufBackNettoImage = 0;
}
if( BufBackImage )
{
GlobalFree( BufBackImage );
BufBackImage = 0;
}
if( BufFrontNettoImage )
{
GlobalFree( BufFrontNettoImage );
BufFrontNettoImage = 0;
}
if( BufFrontImage )
{
GlobalFree( BufFrontImage );
BufFrontImage = 0;
}
memset(BufCodelineSW, 0, sizeof(BufCodelineSW));
memset(BufCodelineHW, 0, sizeof(BufCodelineHW));
memset(BufBarcode, 0, sizeof(BufBarcode));
Reply = LSGetDocData(hLS,
hWnd,
NrCheque ++;
Reply = LSCodelineReadFromBitmap(hWnd,
(HANDLE)BufFrontImage,
&stParDocHandle.CodelineOptType,
stParDocHandle.Unit_measure,
stParDocHandle.Codeline_Sw_x,
stParDocHandle.Codeline_Sw_y,
stParDocHandle.Codeline_Sw_w,
stParDocHandle.Codeline_Sw_h,
&ro,
BufCodelineSW,
(UINT *)&len_codeline);
if (Reply != LS_OKAY)
{
CheckReply(hWnd, Reply, "LSCodelineReadFromBitmap");
}
}
if (Reply != LS_OKAY)
{
CheckReply(hWnd, Reply, "LS500_ReadPdf417FromBitmap");
}
}
if( !stParDocHandle.ViewOnlyLastImage )
{
ShowCodelineAndImage(Reply,
NrCheque,
stParDocHandle.Side,
(unsigned char *)BufFrontImage,
(unsigned char *)BufBackImage,
(unsigned char *)BufFrontNettoImage,
(unsigned char *)BufBackNettoImage,
BufCodelineSW,
BufCodelineHW,
BufBarcode,
"");
// free bitmaps
if( Save_BufBackNettoImage )
GlobalFree( Save_BufBackNettoImage );
Save_BufBackNettoImage = BufBackNettoImage;
BufBackNettoImage = 0;
if( Save_BufBackImage )
GlobalFree( Save_BufBackImage );
Save_BufBackImage = BufBackImage;
BufBackImage = 0;
if( Save_BufFrontNettoImage )
GlobalFree( Save_BufFrontNettoImage );
Save_BufFrontNettoImage = BufFrontNettoImage;
BufFrontNettoImage = 0;
if( Save_BufFrontImage )
GlobalFree( Save_BufFrontImage );
Save_BufFrontImage = BufFrontImage;
BufFrontImage = 0;
if( BuilderParam.StopLoopOnErrorInCodeline )
{
if( strchr(BufCodelineHW, '!') )
break;
if( stParDocHandle.SaveCodeline )
fclose( fhCodeline );
return ReplyFunz;
} // End DoAutoDocHandle
14.2.1. DoAutoDocHandle()
READOPTIONS ro;
fExitLoop = FALSE;
CurrentBin = 0;
if( (stParDocHandle.Sorter & DOC_SEQUENCE_SORTER) == DOC_SEQUENCE_SORTER )
CurrentBin = 1;
if( (stParDocHandle.Sorter & DOC_ALL_IN_BIN) == DOC_ALL_IN_BIN )
CurrentBin = stParDocHandle.Sorter_AllDocInBin;
fCurrentBin = TRUE;
SorterFull = 0;
SideToFilm = stParDocHandle.Side;
Reply = LS800AutoDocHandle(hLS,
hWnd,
stParDocHandle.Validate,
CodelineType,
SideToFilm,
stParDocHandle.ScanModeFront,
stParDocHandle.ScanModeBack,
stParDocHandle.ClearBlack,
stParDocHandle.NumDoc,
stParDocHandle.SaveImage,
dirBase,
Filename,
UNIT_MM,
stParDocHandle.Codeline_Sw_x,
stParDocHandle.Codeline_Sw_y,
stParDocHandle.Codeline_Sw_w,
stParDocHandle.Codeline_Sw_h,
OCR_FRONT_IMAGE,
stParDocHandle.FileFormat,
stParDocHandle.Quality,
SAVE_OVERWRITE, // SaveMode
1, // PageNumber
stParDocHandle.BeepOnError,
(CodelineType == READ_CODELINE_MICR ? OnCodelineRead : 0),
(CodelineType == NO_READ_CODELINE ? OnImageFrontReady : 0),
NULL,//OnImageBackReady,
0, // Reserved1
0, // Reserved2
NULL); // Reserved3
if (Reply != LS_OKAY)
{
if( Reply != LS_FEEDER_EMPTY )
{
if (CheckReply(hWnd, Reply, "LS800AutoDocHandle"))
{
Reply = LSDisconnect(hLS, hWnd);
return 0;
}
}
}
if( stParDocHandle.SaveCodeline )
if( stParDocHandle.ResetFileCodeline )
fhCodeline = fopen(FullFName, "w+t");
else
fhCodeline = fopen(FullFName, "a+t");
}
if( stParDocHandle.NumDoc )
DocToProcess = stParDocHandle.NumDoc;
else
DocToProcess = 1000000L;
//-----------GetDocData--------------------------------------
while( Reply == LS_OKAY )
{
memset((char *)BufFrontFile, 0, sizeof(BufFrontFile));
memset((char *)BufBackFile, 0, sizeof(BufBackFile));
BufFrontImage = 0;
BufBackImage = 0;
Reply = LSGetDocData(hLS,
hWnd,
NULL,
BufFrontFile,
BufBackFile,
NULL,
NULL,
&BufFrontImage,
&BufBackImage,
NULL,
NULL,
BufCodelineSW,
BufCodelineHW,
NULL,
NULL,
&NumDocRemain,
Lenghts,
NULL,
NULL);
case LS_SORTER_1_POCKET_2_FULL:
SorterFull |= MASK_POCKET_2_FULL;
break;
case LS_SORTER_1_POCKET_3_FULL:
case LS_SORTER_2_POCKET_1_FULL:
SorterFull |= MASK_POCKET_4_FULL;
break;
case LS_SORTER_2_POCKET_2_FULL:
SorterFull |= MASK_POCKET_5_FULL;
break;
case LS_SORTER_2_POCKET_3_FULL:
SorterFull |= MASK_POCKET_6_FULL;
break;
case LS_SORTER_3_POCKET_1_FULL:
SorterFull |= MASK_POCKET_7_FULL;
break;
case LS_SORTER_3_POCKET_2_FULL:
SorterFull |= MASK_POCKET_8_FULL;
break;
case LS_SORTER_3_POCKET_3_FULL:
SorterFull |= MASK_POCKET_9_FULL;
break;
case LS_SORTER_4_POCKET_1_FULL:
SorterFull |= MASK_POCKET_10_FULL;
break;
case LS_SORTER_4_POCKET_2_FULL:
SorterFull |= MASK_POCKET_11_FULL;
break;
case LS_SORTER_4_POCKET_3_FULL:
SorterFull |= MASK_POCKET_12_FULL;
break;
case LS_SORTER_5_POCKET_1_FULL:
SorterFull |= MASK_POCKET_13_FULL;
break;
case LS_SORTER_5_POCKET_2_FULL:
SorterFull |= MASK_POCKET_14_FULL;
break;
case LS_SORTER_5_POCKET_3_FULL:
SorterFull |= MASK_POCKET_15_FULL;
break;
default:
CheckReply(hWnd, Reply, "LSGetDocData");
if( fExitLoop )
break;
}
Warning = LSCodelineReadFromBitmap(hWnd,
BufFrontImage,
&stParDocHandle.CodelineOptType,
stParDocHandle.Unit_measure,
stParDocHandle.Codeline_Sw_x,
stParDocHandle.Codeline_Sw_y,
stParDocHandle.Codeline_Sw_w,
stParDocHandle.Codeline_Sw_h,
&ro,
BufCodelineSW,
(UINT *)&len_codeline);
}
}
if( BufCodelineSW[0] )
strcpy(CodelineRead, BufCodelineSW);
else if( BufCodelineHW[0] )
strcpy(CodelineRead, BufCodelineHW);
if (fOptionViewImage == TRUE)
{
ShowCodelineAndImage(Reply,
NrCheque,
(unsigned char *)BufFrontImage,
(unsigned char *)BufBackImage,
BufCodelineSW,
BufCodelineHW,
NULL,
NULL);
if(stParDocHandle.SaveImage == IMAGE_SAVE_BOTH)
{
//Save the image in JPEG
if( stParDocHandle.FileFormat == SAVE_JPEG )
{
if( ((stParDocHandle.Side == SIDE_FRONT_IMAGE) ||
(stParDocHandle.Side == SIDE_ALL_IMAGE)) &&
(BufFrontImage) )
{
// build filename
sprintf(SaveFile, "%s%s\\f%s%03d.jpg", PathAppl,
SAVE_DIRECTORY_IMAGE, NAME_IMAGE, NrFileJPG);
LSSaveJPEG(hWnd, BufFrontImage, stParDocHandle.Quality,
SaveFile);
}
GlobalFree( hBWImage );
}
}
GlobalFree( hBWImage );
}
}
NrFileTIFF ++;
}
}
if( stParDocHandle.SaveCodeline )
{
if( BufCodelineHW[0] != '\0' )
{
strcat(BufCodelineHW, "\n");
fputs(BufCodelineHW, fhCodeline);
}
if( BufBackImage )
{
GlobalFree( BufBackImage );
BufBackImage = 0;
}
if( BufFrontImage )
{
GlobalFree( BufFrontImage );
BufFrontImage = 0;
}
return Reply;
} // End DoAutoDocHandle
Callback functions:
int OnCodelineRead(S_CODELINE_INFO_LS800 *CodelineInfo)
{
short ii;
case 1:
// Check for error in codeline
if( strchr(CodelineInfo->CodelineRead, '!') )
{
// Set of the sorter ...
CodelineInfo->Sorter = ii;
strcpy(CodelineInfo->StringToPrint1,
stParDocHandle.DocOption[ii].StringToPrint);
}
case 2:
// Check if the right codeline
if( ! strncmp(&CodelineInfo-
>CodelineRead[stParDocHandle.DocOption[ii].StartChar - 1],
stParDocHandle.DocOption[ii].StringCheck,
strlen(stParDocHandle.DocOption[ii].StringCheck)) )
{
// Set of the sorter ...
CodelineInfo->Sorter = ii;
strcpy(CodelineInfo->StringToPrint1,
stParDocHandle.DocOption[ii].StringToPrint);
}
return 0;
} // OnCodelineRead
Warning = LSCodelineReadFromBitmap(0,
ImgInfo->hImage,
&stParDocHandle.CodelineOptType,
stParDocHandle.Unit_measure,
stParDocHandle.Codeline_Sw_x,
stParDocHandle.Codeline_Sw_y,
stParDocHandle.Codeline_Sw_w,
stParDocHandle.Codeline_Sw_h,
&ro,
CodelineRead,
(UINT *)&len_codeline);
if( Warning != LS_OKAY )
{
// On error set sorter ... zero
ImgInfo->Sorter = 0;
return 0;
}
}
case 1:
// Check for error in codeline
if( strchr(CodelineRead, '!') )
{
// Set of the sorter ...
ImgInfo->Sorter = ii;
strcpy(ImgInfo->StringToPrint1,
stParDocHandle.DocOption[ii].StringToPrint);
}
case 2:
// Check if the right codeline
if( ! strncmp(&CodelineRead[stParDocHandle.DocOption[ii].StartChar - 1],
stParDocHandle.DocOption[ii].StringCheck,
strlen(stParDocHandle.DocOption[ii].StringCheck)) )
{
// Set of the sorter ...
ImgInfo->Sorter = ii;
strcpy(ImgInfo->StringToPrint1,
stParDocHandle.DocOption[ii].StringToPrint);
}
return 0;
} // OnImageFrontReady
'//Parameter Beep
Public Const NO_BEEP = 0
Public Const YES_BEEP = 1
'//Parameter SaveOnFile
Public Const IMAGE_SAVE_ON_FILE = 4
Public Const IMAGE_SAVE_HANDLE = 5
Public Const IMAGE_SAVE_BOTH = 6
Public Const IMAGE_SAVE_NONE = 7
'//Parameter FileFormat
Public Const SAVE_JPEG = 10
Public Const SAVE_BMP = 11
Public Const PERIPHERAL_LS100_SIZE_MEMORY = 36864 '36 * 1024 '//Total memory of the peripheral
Public Const PERIPHERAL_LS5xx_SIZE_MEMORY = 65536 '64 * 1024 '//Total memory of the peripheral
'// ------------------------------------------------------------------------
'// REPLY-CODE
'// ------------------------------------------------------------------------
'// ------------------------------------------------------------------------
'// ERRORS
'// ------------------------------------------------------------------------
Public Const LS_SYSTEM_ERROR = -1
Public Const LS_USB_ERROR = -2
Public Const LS_PERIPHERAL_NOT_FOUND = -3
Public Const LS_HARDWARE_ERROR = -4
Public Const LS_PERIPHERAL_OFF_ON = -5
Public Const LS_RESERVED_ERROR = -6
Public Const LS_PAPER_JAM = -7
Public Const LS_TARGET_BUSY = -8
Public Const LS_INVALID_COMMAND = -9
Public Const LS_DATA_LOST = -10
Public Const LS_COMMAND_IN_EXECUTION_YET = -11
Public Const LS_JPEG_ERROR = -12
Public Const LS_COMMAND_SEQUENCE_ERROR = -13
Public Const LS_NOT_USED = -14
Public Const LS_IMAGE_OVERWRITE = -15
Public Const LS_INVALID_HANDLE = -16
Public Const LS_NO_LIBRARY_LOAD = -17
Public Const LS_BMP_ERROR = -18
Public Const LS_TIFF_ERROR = -19
Public Const LS_IMAGE_NO_MORE_AVAILABLE = -20
Public Const LS_IMAGE_NO_FILMED = -21
Public Const LS_IMAGE_NOT_PRESENT = -22
Public Const LS_FUNCTION_NOT_AVAILABLE = -23
Public Const LS_DOCUMENT_NOT_SUPPORTED = -24
Public Const LS_BARCODE_ERROR = -25
Public Const LS_INVALID_LIBRARY = -26
Public Const LS_INVALID_IMAGE = -27
'// ------------------------------------------------------------------------
'// WARNINGS
'// ------------------------------------------------------------------------
Public Const LS_FEEDER_EMPTY = 1
Public Const LS_DATA_TRUNCATED = 2
Public Const LS_DOC_PRESENT = 3
Public Const LS_BADGE_TIMEOUT = 4
Public Const LS_ALREADY_OPEN = 5
Public Const LS_PERIF_BUSY = 6
Public Const LS_DOUBLE_LEAFING_WARNING = 7
Public Const LS_COMMAND_NOT_ENDED = 8
Public Const LS_RETRY = 9
Public Const LS_NO_OTHER_DOCUMENT = 10
Public Const LS_QUEUE_FULL = 11
Public Const LS_NO_SENSE = 12
Public Const LS_TRY_TO_RESET = 14
Public Const LS_STRING_TRUNCATED = 15
Public Const LS_COMMAND_NOT_SUPPORTED = 19
Public Const LS_DOUBLE_LEAFING_ERROR = 38
Public Const LS_KEEP_DOC_ON_CODELINE_ERROR = 39
Public Const LS_LOOP_INTERRUPTED = 40
Public Const LS_SORTER1_FULL = 35
Public Const LS_SORTER2_FULL = 36
Public Const LS_SORTERS_BOTH_FULL = 37
Public Const LS_SORTER_1_POCKET_1_FULL = 51
Public Const LS_SORTER_1_POCKET_2_FULL = 52
Public Const LS_SORTER_1_POCKET_3_FULL = 53
Public Const LS_SORTER_2_POCKET_1_FULL = 54
Public Const LS_SORTER_2_POCKET_2_FULL = 55
Public Const LS_SORTER_2_POCKET_3_FULL = 56
'// ------------------------------------------------------------------------
'// DEFINES STRUTTURES
'// ------------------------------------------------------------------------
TypeCriteria1 As Byte
CharToStart1 As Byte
NrCharCheck1 As Byte
FristString1 As String * 10
SecondString1 As String * 10
Bin1 As Byte
TypeCriteria2 As Byte
CharToStart2 As Byte
NrCharCheck2 As Byte
FristString2 As String * 10
SecondString2 As String * 10
Bin2 As Byte
TypeCriteria3 As Byte
CharToStart3 As Byte
NrCharCheck3 As Byte
FristString3 As String * 10
'// structure for read usefull information about the just stored image
Public Type THistory
Size As Integer '// Size of the struct
doc_sorted As Long '// Document sortered
bourrage_feeder As Long '// Jam in the feeder
bourrage_micr As Long '// Jam during the MICR reading
doc_retain As Long '// Nr. of document retained
bourrage_exit As Long '// Jam after the film
doc_cmc7_err As Long '// Nr. of document CMC7, read with error
doc_e13b_err As Long '// Nr. of document E13B, read with error
time_peripheral_on As Long '// Peripheral time life
num_turn_on As Long '// Nr. of power on
doc_ink_jet As Long '// Nr. of document printed
doc_stamp As Long '// Nr. of document stamped
End Type
'// ------------------------------------------------------------------------
'// EXPORT FUNCTIONS
'// ------------------------------------------------------------------------
Public Declare Function LSConnect Lib "LsApi.dll" ( _
ByVal HWND As Long, _
ByVal hInst As Long, _
ByVal iPeripheral As Integer, _
ByRef lphConnect As Integer) As Long
Public Declare Function LSAutoDocHandle Lib "LsApi.dll" (ByVal hConnect As Integer, ByVal HWND As
Long, _
ByVal iStamp As Integer, _
ByVal iValidate As Integer, _
ByVal iCodeline As Integer, _
ByVal iScanMode As Integer, _
ByVal iFeeder As Integer, _
CtsLsClass.cs
using System;
using System.Runtime.InteropServices;
namespace Ls_Test
{
class CtsLs
{
[DllImport("LsApi.dll")]
public static extern int LSConnect(int hWnd, int hInst, short
Peripheral, ref short hConnect);
[DllImport("LsApi.dll")]
public static extern int LSDisconnect(short hConnect, int hWnd);
[DllImport("LsApi.dll")]
public static extern int LSUnitIdentify(short hConnect, int hWnd, byte[]
pLsCfg, IntPtr LsModel, IntPtr FwVersion, IntPtr FwDate, IntPtr PeripheralID,
IntPtr BoardVersion, IntPtr DecoderExpVersion, IntPtr InkJetVersion, IntPtr
FeederVersion, IntPtr SorterVersion, IntPtr MotorVersion, IntPtr Reserved1,
IntPtr Reserved2);
[DllImport("LsApi.dll")]
public static extern int LSUnitStatus(short hConnect, int hWnd, ref
UNITSTATUS lpStatus);
[DllImport("LsApi.dll")]
public static extern int LSReset(short hConnect, int hWnd, short
ResetType);
[DllImport("LsApi.dll")]
public static extern int LSLoadStringWithCounterEx(short hConnect, int
hWnd, short PrintType, IntPtr strEndorse, short LenEndorse, UInt32 StartNumber,
short Step);
[DllImport("LsApi.dll")]
public static extern int LSLoadString(short hConnect, int hWnd, short
PrintType, short LenEndorse, IntPtr strEndorse);
[DllImport("LsApi.dll")]
public static extern int LSConfigDoubleLeafingAndDocLength(short
hConnect, int hWnd, Int32 Type, short Value, Int32 DocMin, Int32 DocMax);
[DllImport("LsApi.dll")]
public static extern int LSChangeStampPosition(short hConnect, int hWnd,
short Step, byte Reserved);
[DllImport("LsApi.dll")]
public static extern int LSDisableWaitDocument(short hConnect, int hWnd,
bool fWait);
[DllImport("LsApi.dll")]
public static extern int LSSetUnitSpeed(short hConnect, int hWnd, short
UnitSpeed);
[DllImport("LsApi.dll")]
public static extern int LSSetLightIntensity(short hConnect, int hWnd,
short UnitSpeed);
[DllImport("LsApi.dll")]
public static extern int LSModifyPWMUltraViolet(short hConnect, int
hWnd, short UnitSpeed, bool HighContrast, short Reserved);
[DllImport("LsApi.dll")]
public static extern int LSAutoDocHandle(short hConnect, int hWnd, short
Stamp, short Validate, short CodeLine, short ScanMode, short Feeder, short
READ_BARCODE_2_OF_5 = 50,
READ_BARCODE_CODE39 = 51,
READ_BARCODE_CODE128 = 52,
READ_BARCODE_EAN13 = 53,
DOUBLE_LEAFING_WARNING = 0 ,
DOUBLE_LEAFING_ERROR = 1 ,
//DOUBLE_LEAFING_LEVEL1 = 1,non lo uso piu'
DOUBLE_LEAFING_LEVEL2 = 2,
DOUBLE_LEAFING_LEVEL3 = 3,
DOUBLE_LEAFING_DEFAULT = 4,
DOUBLE_LEAFING_LEVEL4 = 5,
DOUBLE_LEAFING_LEVEL5 = 6,
DOUBLE_LEAFING_DISABLE = 7,
};
// ---------------------------------------------------------------
// ERRORS
// ---------------------------------------------------------------
public const int LS_SYSTEM_ERROR = -1;
public const int LS_USB_ERROR = -2;
public const int LS_PERIPHERAL_NOT_FOUND = -3;
public const int LS_HARDWARE_ERROR = -4;
public const int LS_PERIPHERAL_OFF_ON = -5;
public const int LS_RESERVED_ERROR = -6;
public const int LS_PAPER_JAM = -7;
public const int LS_TARGET_BUSY = -8;
public const int LS_INVALID_COMMAND = -9;
public const int LS_DATA_LOST = -10;
public const int LS_COMMAND_IN_EXECUTION_YET = -11;
public const int LS_JPEG_ERROR = -12;
public const int LS_COMMAND_SEQUENCE_ERROR = -13;
public const int LS_PC_HW_ERROR = -14;
public const int LS_IMAGE_OVERWRITE = -15;
public const int LS_INVALID_HANDLE = -16;
public const int LS_NO_LIBRARY_LOAD = -17;
public const int LS_BMP_ERROR = -18;
public const int LS_TIFF_ERROR = -19;
// ---------------------------------------------------------------
// WARNINGS
// ---------------------------------------------------------------
public const int LS_FEEDER_EMPTY = 1;
public const int LS_DATA_TRUNCATED = 2;
public const int LS_DOC_PRESENT = 3;
public const int LS_BADGE_TIMEOUT = 4;
public const int LS_ALREADY_OPEN = 5;
public const int LS_PERIPHERAL_BUSY = 6;
public const int LS_DOUBLE_LEAFING_WARNING = 7;
public const int LS_COMMAND_NOT_ENDED = 8;
public const int LS_RETRY = 9;
public const int LS_NO_OTHER_DOCUMENT = 10;
public const int LS_QUEUE_FULL = 11;
public const int LS_NO_SENSE = 12;
public const int LS_TRY_TO_RESET = 14;
public const int LS_STRING_TRUNCATED = 15;
public const int LS_COMMAND_NOT_SUPPORTED = 19;
public const int LS_SORTER1_FULL = 35;
public const int LS_SORTER2_FULL = 36;
public const int LS_SORTERS_BOTH_FULL = 37;
public const int LS_KEEP_DOC_ON_CODELINE_ERROR = 39;
public const int LS_LOOP_INTERRUPTED = 40;
ident.Text = "";
Reply = LSConnect(0, 0, model, ref hConnect);
if (Reply == CtsLs.LsReply.LS_OKAY)
{
String strIdentify;
string blankOpt = " ";
Reply = CtsLs.LSUnitIdentify(hConnect, 0,
UnitCfg,
strLsModel,
strFwVersion,
Date_Fw,
strUnitID,
IntPtr.Zero, // BoardVersion
DecoderExpVersion,
strInkJetVersion,
IntPtr.Zero, //FeederVersion,
IntPtr.Zero, //SorterVersion,
IntPtr.Zero, //Motorversion,
IntPtr.Zero, //Reserved1,
IntPtr.Zero);//Reserved2
if (Reply == LS_OKAY)
{
switch (model)
{
case LS_100_USB:
strIdentify = "FW version: " + Marshal.PtrToStringAnsi(strLsModel) + "\n"
+ "FW Date: " + Marshal.PtrToStringAnsi(strFwVersion) + "\n"
+ "Serial #: " + Marshal.PtrToStringAnsi(strSerialNumber) + "\n";
i1 = "OPTIONS:\n";
b = 0x1;
a = (byte) (LpldPnt[1] & b);
if (a == 0x1)
i1 = i1 + "Micr ";
b = 0x8;
a = (byte) (LpldPnt[1] & b);
case LS_150_USB:
strIdentify = "Model : " + Marshal.PtrToStringAnsi(strLsModel) + "\n" +
"FW version : " + Marshal.PtrToStringAnsi(strFwVersion) + "\n" +
"FW date : " + Marshal.PtrToStringAnsi(Date_Fw) + "\n\n" +
"Serial #: " + Marshal.PtrToStringAnsi(strUnitID) + "\n\n" +
"Options :\n";
case LS_515_USB:
strIdentify = "FW version: " + Marshal.PtrToStringAnsi(strLsModel) + "\n"
+ "FW Date: " + Marshal.PtrToStringAnsi(strFwVersion) + "\n"
+ "Serial #: " + Marshal.PtrToStringAnsi(strSerialNumber) + "\n";
i1 = "OPTIONS:\n";
b = 0x1;
a = (byte)(LpldPnt[1] & b);
if (a == 0x1)
i1 = i1 + "CMC7 ";
b = 0x2;
a = (byte)(LpldPnt[1] & b);
if (a == 0x2)
i1 = i1 + "E13B ";
b = 0x8;
a = (byte)(LpldPnt[1] & b);
if (a == 0x8)
{
i1 = i1 + "Ink-jet ";
inkJetPresent = true;
}
b = 0x10;
a = (byte)(LpldPnt[1] & b);
if (a == 0x10)
i1 = i1 + "BackStamp ";
b = 0x20;
a = (byte)(LpldPnt[1] & b);
if (a == 0x20)
i1 = i1 + "FrontStamp ";
a = (byte)(LpldPnt[2] & 0x10);
if (a == 0x10) // Badge present
i1 = i1 + "Badge";
strIdentify += i1;
break;
}
}
else
MessageBox.Show(strIdentify, TITLE_POPUP);
LSDisconnect(hConnect, 0);
} // ok the Connect
else
MessageBox.Show("Connect not possible: error", TITLE_POPUP);
}
}
if (Reply != LS_OKAY)
{
// Error Handling
MessageBox.Show("Open not done: error " + Reply.ToString());
return Reply;
}
PrintValidate = CtsLs.PrintValidate.PRINT_VALIDATE;
//-----------LoadString--------------------------------------
if (stParAppl.PrintValidate == CtsLs.PrintValidate.PRINT_VALIDATE ||
stParAppl.PrintValidate ==
(CtsLs.PrintValidate)CtsLs.PrintFont.PRINT_FORMAT_NORMAL_15)
{
IntPtr strEndorse = Marshal.AllocHGlobal(160); ;
if (stParAppl.PrintValidate ==
(CtsLs.PrintValidate)CtsLs.PrintFont.PRINT_FORMAT_NORMAL_15)
PrintType = CtsLs.PrintFont.PRINT_FORMAT_NORMAL_15;
if( stParAppl.PrintHigh == 0 )
PrintType += 0x20;
if( stParAppl.Endorse_str.Contains("%d") )
Reply = CtsLs.LSLoadStringWithCounterEx(hConnect, 0,
(short)PrintType,
strEndorse,
(short)stParAppl.Endorse_str.Length,
8, 3);
else
Reply = CtsLs.LSLoadString(hConnect, 0,
(short)PrintType,
(short)stParAppl.Endorse_str.Length,
strEndorse);
if (Reply != CtsLs.LsReply.LS_OKAY)
{
if (CheckReply(Reply, "LSLoadString"))
{
return Reply;
}
}
Reply = CtsLs.LSAutoDocHandle(hConnect, 0,
stParAppl.FrontStamp,
(short)PrintValidate,
(short)CodelineType,
stParAppl.ScanMode,
(short)CtsLs.Feeder.FEED_AUTO,
(short)CtsLs.Sorter.SORTER_POCKET_1,
stParAppl.NumDoc,
stParAppl.ClearAlignImage,
stParAppl.Side,
0,
stParAppl.SaveImage,
dirBase,
Filename,
C_x, C_y, C_w, C_h,
(short)CtsLs.Unit.UNIT_MM,
0,
stParAppl.FileFormat,
stParAppl.Qual,
(short)CtsLs.FileAttribute.SAVE_OVERWRITE,
1,
(short)(stParAppl.WaitTimeout ?
CtsLs.Wait.WAIT_YES : CtsLs.Wait.WAIT_NO),
(short)stParAppl.BeepOnError,
0,
IntPtr.Zero,
IntPtr.Zero);
if (Reply != CtsLs.LsReply.LS_OKAY)
{
if (CheckReply(Reply, "LSAutoDocHandle"))
{
return Reply;
}
if (Save_FrontImage != IntPtr.Zero)
{
CtsLs.LSFreeImage(0, ref Save_FrontImage);
Save_FrontImage = IntPtr.Zero;
}
if (Save_RearImage != IntPtr.Zero)
{
CtsLs.LSFreeImage(0, ref Save_RearImage);
Save_RearImage = IntPtr.Zero;
}
//-----------GetDocData--------------------------------------
Bitmap pBitmap = null;
Marshal.WriteByte(BufCodelineSW, 0);
Marshal.WriteByte(BufCodelineHW, 0);
Marshal.WriteByte(BufBarcode, 0);
Reply = CtsLs.LSGetDocData(hConnect, 0,
ref NrDoc,
BufFrontFile,
BufRearFile,
IntPtr.Zero, //BufFrontNettoFile,
IntPtr.Zero, //BufBackNettoFile,
ref BufFrontImage,
ref BufRearImage,
ref BufFrontUVImage,
ref NoImage, //BufbackNettoImage,
BufCodelineSW,
BufCodelineHW,
BufBarcode,
IntPtr.Zero,
ref DocToRead,
ref NrPrinted,
IntPtr.Zero,
ro.PutBlanks = 1;
ro.TypeRead = 'N';
if( stParAppl.CodelineOCR == CtsLs.CodeLineType.READ_CODELINE_SW_E13B_X_OCRB )
{
ro.TypeRead = 'X';
CodelineOpt[0] = (byte)CtsLs.CodeLineType.READ_CODELINE_SW_E13B;
CodelineOpt[1] = (byte)CtsLs.CodeLineType.READ_CODELINE_SW_OCRB_ITALY;
CodelineOpt[2] = (byte)'\0';
}
else
{
CodelineOpt[0] = (byte)stParAppl.CodelineOCR;
CodelineOpt[2] = (byte)'\0';
}
len_codeline = (int)CtsLs.CodeLineType.MAX_CODE_LINE_LENGTH;
Reply = CtsLs.LSCodelineReadFromBitmap(0,
BufFrontImage,
CodelineOpt,
stParAppl.Unit_measure,
stParAppl.Codeline_Sw_x,
stParAppl.Codeline_Sw_y,
stParAppl.Codeline_Sw_w,
stParAppl.Codeline_Sw_h,
ref ro,
BufCodelineSW,
ref len_codeline);
if( Reply != CtsLs.LsReply. LS_OKAY )
{
CheckReply(Reply, "LSCodelineReadFromBitmap");
Reply = CtsLs.LsReply.LS_OKAY; // Set Ok for not
exit from the loop
}
}
if ((TypeOfDecod & DECODE_BARCODE) == DECODE_BARCODE )
{
int len_barcode = (int)CtsLs.CodeLineType.MAX_CODE_LINE_LENGTH;
Reply = CtsLs.LSReadBarcodeFromBitmap(0,
Reply = CtsLs.LSReadPdf417FromBitmap(0,
BufFrontImage,
BufBarcode,
ref len_barcode,
0, 0, 0, 0, 0);
if (Reply != CtsLs.LsReply. LS_OKAY)
{
CheckReply(Reply, "LSReadPdf417FromBitmap");
Reply = CtsLs.LsReply.LS_OKAY; // Set Ok for not
exit from the loop
}
}
if (stParAppl.ScanMode == (short)CtsLs.ScanMode.SCAN_MODE_256GR100_AND_UV ||
stParAppl.ScanMode == (short)CtsLs.ScanMode.SCAN_MODE_256GR200_AND_UV ||
stParAppl.ScanMode == (short)CtsLs.ScanMode.SCAN_MODE_256GR300_AND_UV)
{
// Build the mergered gray UV image
if (BufFrontUVImage != IntPtr.Zero)
{
CtsLs.LSMergeImageGrayAndUV(0,
BufFrontImage,
BufFrontUVImage,
0, //stParAppl.Threshold_UV,
0,
ref BufFrontGrayUVImage);
//if( stParAppl.SaveImage == IMAGE_SAVE_ON_FILE ||
stParAppl.SaveImage == IMAGE_SAVE_BOTH )
//{
// // Check if I must save the image
// if( stParAppl.FileFormat == (short)CtsLs.FileType.FILE_JPEG )
// {
// FullFName, "%s\\%s%04dGUV.jpg", dirBase, Filename, (NrDoc
- 1));
// Reply = LSSaveJPEG(hWnd, BufFrontGrayUVImage,
stParAppl.Qual, FullFName);
// }
// else if( stParAppl.FileFormat ==
(short)CtsLs.FileType.FILE_BMP )
// {
// Show Codeline
if (Marshal.ReadByte(BufCodelineHW) != 0)
tbCodeline.Text = Marshal.PtrToStringAnsi(BufCodelineHW);
else
tbCodeline.Text = "";
if (pbImage.Image != null)
{
pbImage.Image.Dispose();
// //pbImage.Image = null;
}
pbImage.Image = pBitmap;
if (Save_RearImage != IntPtr.Zero)
{
CtsLs.LSFreeImage(0, ref Save_RearImage);
}
Save_RearImage = BufRearImage;
NrCheque ++;
} // Fine while( TRUE )
CtsLsClass.vb
Imports System.Runtime.InteropServices
READ_CODELINE_SW_OCRA = 65 ''A',
READ_CODELINE_SW_OCRB_NUM = 66 ''B',
READ_CODELINE_SW_OCRB_ALFANUM = 67 ''C',
READ_CODELINE_SW_OCRB_ITALY = 70 ''F',
READ_CODELINE_SW_E13B = 69 ''E',
READ_CODELINE_SW_E13B_X_OCRB = 88 ''X',
READ_BARCODE_2_OF_5 = 50
READ_BARCODE_CODE39 = 51
READ_BARCODE_CODE128 = 52
' READ_BARCODE_EAN13 = 53,
MAX_CODE_LINE_LENGTH = 254
End Enum
DOUBLE_LEAFING_WARNING = 0
DOUBLE_LEAFING_ERROR = 1 'DOUBLE_LEAFING_LEVEL1 = 1,non lo uso piu'
DOUBLE_LEAFING_LEVEL2 = 2
DOUBLE_LEAFING_LEVEL3 = 3
DOUBLE_LEAFING_DEFAULT = 4
DOUBLE_LEAFING_LEVEL4 = 5
DOUBLE_LEAFING_LEVEL5 = 6
DOUBLE_LEAFING_DISABLE = 7
End Enum
' ---------------------------------------------------------------------
' ERRORS
' ---------------------------------------------------------------------
Public Const LS_SYSTEM_ERROR As Integer = -1
Public Const LS_USB_ERROR As Integer = -2
Public Const LS_PERIPHERAL_NOT_FOUND As Integer = -3
Public Const LS_HARDWARE_ERROR As Integer = -4
Public Const LS_PERIPHERAL_OFF_ON As Integer = -5
Public Const LS_RESERVED_ERROR As Integer = -6
Public Const LS_PAPER_JAM As Integer = -7
Public Const LS_TARGET_BUSY As Integer = -8
' ---------------------------------------------------------------------
' WARNINGS
' ---------------------------------------------------------------------
Public Const LS_FEEDER_EMPTY As Integer = 1
Public Const LS_DATA_TRUNCATED As Integer = 2
Public Const LS_DOC_PRESENT As Integer = 3
Public Const LS_BADGE_TIMEOUT As Integer = 4
Public Const LS_ALREADY_OPEN As Integer = 5
Public Const LS_PERIPHERAL_BUSY As Integer = 6
Public Const LS_DOUBLE_LEAFING_WARNING As Integer = 7
Public Const LS_COMMAND_NOT_ENDED As Integer = 8
Public Const LS_RETRY As Integer = 9
Public Const LS_NO_OTHER_DOCUMENT As Integer = 10
Public Const LS_QUEUE_FULL As Integer = 11
Public Const LS_NO_SENSE As Integer = 12
Public Const LS_TRY_TO_RESET As Integer = 14
Public Const LS_STRING_TRUNCATED As Integer = 15
Public Const LS_COMMAND_NOT_SUPPORTED As Integer = 19
Public Const LS_SORTER1_FULL As Integer = 35
Public Const LS_SORTER2_FULL As Integer = 36
Public Const LS_SORTERS_BOTH_FULL As Integer = 37
Public Const LS_KEEP_DOC_ON_CODELINE_ERROR As Integer = 39
Public Const LS_LOOP_INTERRUPTED As Integer = 40
hConnect = 0
' BoardVersion
'FeederVersion,
'SorterVersion,
'Motorversion,
'Reserved1,
Reply = CtsLs.LSUnitIdentify(hConnect, 0, UnitCfg, strLsModel,
strFwVersion, Date_Fw, _
strUnitID, IntPtr.Zero, DecoderExpVersion, strInkJetVersion,
IntPtr.Zero, IntPtr.Zero, _
IntPtr.Zero, IntPtr.Zero, IntPtr.Zero)
'Reserved2
If Reply = CtsLs.LsReply.LS_OKAY Then
strIdentify = "Model : " & Marshal.PtrToStringAnsi(strLsModel) &
vbLf & "FW version : " & Marshal.PtrToStringAnsi(strFwVersion) & vbLf & "FW date
: " & Marshal.PtrToStringAnsi(Date_Fw) & vbLf & vbLf & "Serial #: " &
Marshal.PtrToStringAnsi(strUnitID) & vbLf & vbLf & "Options :" & vbLf
If Marshal.PtrToStringAnsi(strLsModel).Contains("LS40") = True
Then
If (UnitCfg(0) And &H1) = &H1 Then
strIdentify += blankOpt & "MICR reader" & vbLf
MessageBox.Show(strIdentify, TITLE_POPUP)
End If
Reply = CtsLs.LSDisconnect(hConnect, 0)
Else
CheckReply(Reply, "LSConnect")
End If
End Sub
PrintValidate = CtsLs.PrintValidate.NO_PRINT_VALIDATE
'-----------LoadString--------------------------------------
If stParAppl.PrintValidate <> CtsLs.PrintFont.PRINT_NO_STRING Then
Dim strEndorse As IntPtr = Marshal.AllocHGlobal(160)
' Copy the Secure string to unmanaged memory (and decrypt it).
strEndorse = Marshal.StringToHGlobalAnsi(stParAppl.Endorse_str)
If stParAppl.Endorse_str.Contains("%d") Then
Reply = CtsLs.LSLoadStringWithCounterEx(hConnect, 0,
CShort(stParAppl.PrintValidate), strEndorse,
CShort(stParAppl.Endorse_str.Length), 8, _
3)
CodelineType = CtsLs.CodeLineType.NO_READ_CODELINE
TypeOfDecod = stParAppl.TypeOfDecod
C_x = C_y = C_w = C_h = 0
If stParAppl.CodelineMICR <> CtsLs.CodeLineType.NO_READ_CODELINE Then
CodelineType = stParAppl.CodelineMICR
ElseIf stParAppl.CodelineOCR <> CtsLs.CodeLineType.NO_READ_CODELINE Then
CodelineType = stParAppl.CodelineOCR
C_x = stParAppl.Codeline_Sw_x
C_y = stParAppl.Codeline_Sw_y
C_w = stParAppl.Codeline_Sw_w
C_h = stParAppl.Codeline_Sw_h
TypeOfDecod -= DECODE_OCR
ElseIf stParAppl.BarcodeType <> CtsLs.CodeLineType.NO_READ_CODELINE Then
CodelineType = stParAppl.BarcodeType
C_x = stParAppl.Barcode_Sw_x
C_y = stParAppl.Barcode_Sw_y
C_w = stParAppl.Barcode_Sw_w
C_h = stParAppl.Barcode_Sw_h
TypeOfDecod -= DECODE_OCR
End If
'-----------GetDocData--------------------------------------
Dim pBitmap As Bitmap = Nothing
Marshal.WriteByte(BufCodelineSW, 0)
Marshal.WriteByte(BufCodelineHW, 0)
Marshal.WriteByte(BufBarcode, 0)
'BufFrontNettoFile,
'BufBackNettoFile,
'BufbackNettoImage,
Reply = CtsLs.LSGetDocData(hConnect, 0, NrDoc, BufFrontFile,
BufRearFile, IntPtr.Zero, _
IntPtr.Zero, BufFrontImage, BufRearImage, BufFrontUVImage, NoImage,
BufCodelineSW, _
BufCodelineHW, BufBarcode, IntPtr.Zero, DocToRead, NrPrinted,
IntPtr.Zero, _
IntPtr.Zero)
ro.PutBlanks = 1
ro.TypeRead = "N"c
If stParAppl.CodelineOCR =
CtsLs.CodeLineType.READ_CODELINE_SW_E13B_X_OCRB Then
ro.TypeRead = "X"c
CodelineOpt(0) =
CByte(CtsLs.CodeLineType.READ_CODELINE_SW_E13B)
CodelineOpt(1) =
CByte(CtsLs.CodeLineType.READ_CODELINE_SW_OCRB_ITALY)
CodelineOpt(2) = CByte(AscW(ControlChars.NullChar))
Else
CodelineOpt(0) = CByte(stParAppl.CodelineOCR)
CodelineOpt(2) = CByte(AscW(ControlChars.NullChar))
End If
len_codeline = CInt(CtsLs.CodeLineType.MAX_CODE_LINE_LENGTH)
If stParAppl.ScanMode =
CShort(CtsLs.ScanMode.SCAN_MODE_256GR100_AND_UV) OrElse stParAppl.ScanMode =
CShort(CtsLs.ScanMode.SCAN_MODE_256GR200_AND_UV) OrElse stParAppl.ScanMode =
CShort(CtsLs.ScanMode.SCAN_MODE_256GR300_AND_UV) Then
' Build the mergered gray UV image
If BufFrontUVImage <> IntPtr.Zero Then
'stParAppl.Threshold_UV,
' Free the previous image memory and save the current
If Save_FrontImage <> IntPtr.Zero Then
CtsLs.LSFreeImage(0, Save_FrontImage)
End If
If BufFrontGrayUVImage <> IntPtr.Zero Then
If (System.Threading.Interlocked.Decrement(DocToProcess)) = 0 Then
Exit While
End If
NrCheque += 1
End While
' Fine while( TRUE )
' Free of local variable
Marshal.FreeHGlobal(Filename)
Marshal.FreeHGlobal(dirBase)
Marshal.FreeHGlobal(BufBarcode)
Marshal.FreeHGlobal(BufCodelineHW)
Marshal.FreeHGlobal(BufCodelineSW)
Marshal.FreeHGlobal(BufRearFile)
Marshal.FreeHGlobal(BufFrontFile)
Return Reply
End Function
Class
Symbolic Name Description Possible Reasons