Create an instance.
Create a context.
If applicable, set the port range.
Specify scan settings.
If applicable, set the Observer.
Call one of the scan functions.
Get previously created scan context.
Note: All examples in the following sections are shown using Java. |
In order to use LexImgTk-x.x.jar, you must:
Create an instance variable:
LITScan litScan;
Create an instance where
is the absolute path of the config.properties file:litScan=new LITScan(config_pro_file_path);
You can also create the instance using the default configuration:
litScan=new LITScan();
Note: A default configuration cannot be used in a Linux environment, because the location of the config.properties file must be passed. |
litScan.createContext().
This function returns a long integer value that is used as a handle to refer to a particular scan.
In order to create the handle, you must provide a valid printer address, a profile name, and a TCP port number for the Toolkit to listen on for printer connections. The function will use the default scan values for each created scan context.
Setting | Default value |
---|---|
brightness | 4 |
colorDepth | 8 |
compression | JPEG |
contrast | TEXT |
duplex | SINGLE |
edgeToEdge | FALSE |
jobBuild | FALSE |
jpegQuality | 80 |
linearXfer | FALSE |
orientation | PORTRAIT |
paperSize | LETTER |
resolution | 150 |
scanPreview | FALSE |
shortcut | 0 |
type | JPEG |
String profile = profileText.getText(); String ipAddress = mfpIPText.getText(); …………………… index = litScan.createContext(ipAddress, profile,9750);
The Set Port Range function is called to designate which ports the Toolkit will use for receiving images. Lower and upper port range values are passed as a parameter, and must be set between 1024 and 65535. If both the lower and upper port numbers are set to -1, the port range function will be disabled, and any previously set port range values will be deleted.
if(isEmptyLowerPort && isEmptyUpperPort){ try{ litScan.setPortRange(-1,-1); ……….. else if(!isEmptyLowerPort && !isEmptyUpperPort && !isNotIntegerLowerPort && !isNotIntegerUpperPort){ try{ litScan.setPortRange(lowPort,upperPort); ………………………………
The Imaging Toolkit allows scan parameters to be set individually for each context. Call litScan.setSettings() to adjust settings, or litScan.getSettings() to view the current set of parameters for a given context.
Note: Scan parameters are case-sensitive. For more information about legal values for scan settings, see Scan settings. |
Map temp=new HashMap();
temp.putAll(sm); .......... temp.put("resolution","200"); ..........
litScan.scanBlock() litScan.ScanNoBlock()
The two scan function options enable you to scan with or without a blocking function. The non-blocking version allows the application to respond to your input. When you call the function, the profile is sent to the printer and the Toolkit waits for the printer to connect back to it.
String str=(String)model.getElementAt(selectedIndex); int idScanBack=Integer.parseInt(str);
You can use the following sample code to display a previously created context in the context list when the application is launched:
ScanInfo[] scList=lit.getInitScanContext(); ...... while(index< scList[index].getContextID(); listModel.addElement(String.valueOf(contextID)); String profile=scList[index].getProfileName(); String ipAddress=scList[index].getMfpIPAdress(); String fileName=scList[index].getOutputLocation(); ......... }
The sample application is a Java Swing application that uses LexImgTk-x.x.jar to send scan profiles to a printer and receive the scanned images back from the printer. The LITScan APIs exposed by LexImgTk-x.x.jar consist of public functions of the class LITScan that facilitate the imaging process. The sample application can be run from the command line, as long as LexImgTk-x.x.jar has been included in the CLASSPATH.
Create a context by specifying the following:
The IP address or host name of the destination printer
A profile name
Once this information has been typed into the appropriate fields, click Create Context. An integer should appear in the Contexts list. Create Context calls the LITScan.createContext function to create the context and the LITScan.setObserver function to enable your application to receive status information from the JAR file.
Set the port range.
Lower and upper port range values can be set by typing a value (between 1024 and 65535) in the corresponding field and clicking Set Port Range.
If port range settings are left blank, then the server will attempt to open a socket on the first available port. In this case, the port range function will be disabled, and any previously set port ranges will be deleted.
After a context has been created, default values will be shown for all scan settings.
Adjust scan settings, if necessary, by typing new values in the appropriate fields, and then click Set Scan Values to call the LITScan.setSettings function. Invalid settings will not be saved. For more information about legal values for scan settings, see Scan settings.
Note: To test whether your new settings have been accepted, click Get Scan Values to call LITScan.getSettings and display the saved values. |
Type the full path of the icon file.
If the printer has a control panel with a welcome screen, then an icon will be sent to the printer and placed on the welcome screen.
Note: Icon images can be GIF, JPEG, or PNG, with dimensions of 120 x 75 pixels that is 11KB or smaller. |
Click Start Scan to send a profile to the printer by calling the LITScan.scanNoBlock() function. This is a non-blocking call. Updates on status come through the observer, which outputs text into the output window.
Initiate a scan at the printer by choosing the appropriate profile name, shortcut number, or icon on the printer control panel.
Click | To |
---|---|
Cancel Scan | Cancel the scan job. |
Release Context | Release any resources used by the scan context. |
Remove Profile | Delete the profile currently selected in the profile name field. |
Exit | Terminate the application. |
The following is a list of possible error messages that you can receive while using the Imaging Toolkit. Information contained in brackets is a variable, and is filled in by the code when the error occurs.
Note: Only Toolkit-specific error messages are provided. Messages resulting from unexpected behavior within Java are not listed. |
Unable to remove profile: <profileName>
Failed to load default file <DefaultFileName>
Scan Settings failed verification.
Illegal port range.
Invalid output path or directory does not exist.
Image acquisition failed. No available socket ports.
Image acquisition failed. Profile failed to upload.
Image acquisition failed. Connection failure.
Image acquisition failed. Socket exception.
Image acquisition failed. Unlicensed MFP.
Image acquisition failed. Profile missing from MFP.
Failed to copy temporary file.
Failed to rotate image.
User canceled.
Corrupt defaults file.
<propertyName> <value> is not supported. Use one of the following: <list of legal values>
Wrong jpeg compression.
Shortcut <shortcut value> cannot be a negative number.
The following error messages are specific to OptraImageTM printers only:
Application error
MFP Error - Bad Field
MFP Error - Max Storage Reached
MFP Error - Function Disabled
MFP Error - Duplicate Shortcut