KDS TWAIN Source
Programmatic Printing
June 22, 2012
Revision 1.13
Contents
Abstract............................................................................................................................................................................. 3
Audience.......................................................................................................................................................................... 3
Programmatic Discovery of Printing Functionality.................................................................................................... 3
Printer Capabilities ........................................................................................................................................................ 3
Sample for i2900/i3000/i4000/i5000 scanners without image address ........................................................... 10
Sample for i800/i1800 scanners with image address .......................................................................................... 12
Sample for i200/i600/i700/i1400 scanners .............................................................................................................. 13
The following scanners are supported for printer: i200/i600/i700/i800/i1400/i1800/i2900/i3000/i4000/i5000. The level and kind of support differs between the various scanners. This document details the methods of programmatic control for document printing and gives some examples of use.
It is assumed that the reader has a basic knowledge of the Kodak line of Document Scanners and of the TWAIN Specification (version 1.8 or higher). This document is intended for use by TWAIN integrators.
The CAP_PRINTERENABLED capability is used to determine if a printer is available. A DG_CONTROL / DAT_CAPABILITY / MSG_GET operation will return a failure if printing is not supported.
There is no way for TWAIN to know programmatically if a scanner has a printer installed. It’s up to the application to know what was done with the Mode Setup Software, and present that information to the operator.
The i600/i700/i800/i1800/i4000/i5000 scanners only support printing on the front side of a document. Printing is performed before the image is scanned.
The i200/i1400/i2900/i3000 scanners only support printing on the rear side of a document. Printing is performed after image is scanned.
Not all the printer capabilities are supported for every scanner, therefore the scanner models are specified in every printer capability. The allowed values and default are specified for each scanner specific.
CAP_PRINTERDATE
Scanners: i600/i700/i1800/i2900/i3000/i4000/i5000
Container: TWON_ONEVALUE
Type: TWTY_STR255
Values: YYYY/MM/DD (YYYY - year, MM - month, DD - day)
Default: empty string
Standard: No, custom capability
Use: This will set the scanner to a specific date prior to printing. The scanner will be returned to the original date afterwards.
Set to empty string to disable.
CAP_PRINTERDATEDELIMITER
Scanners: All
Container: TWON_ENUMERATION
Type: TWTY_UINT16
Values: TWPD_NONE, TWPD_FORWARDSLASH, TWPD_HYPHEN, TWPD_PERIOD, TWPD_BLANK
Default: i800: TWPD_FORWARDSLASH
Others: TWPD_NONE
Standard: No, custom capability
Use: Selects the delimiter used in the date.
CAP_PRINTERDATEFORMAT
Scanners: i600/i700/i800/i1400/i1800/i2900/i3000/i4000/i5000
Container: TWON_ENUMERATION
Type: TWTY_UINT16
Values: i600/i800/i1400: TWPE_MMDDYYYY, TWPE_DDMMYYYY, TWPE_YYYYMMDD,
Others: TWPE_MMDDYYYY, TWPE_DDMMYYYY, TWPE_YYYYMMDD, TWPE_DDD, TWPE_YYYYDDD
Default: i800: TWPE_MMDDYYYY
Others: TWPE_YYYYMMDD
Standard: No, custom capability
Use: Selects the format of the date.
CAP_PRINTERENABLED
Scanners: All
Container: TWON_VALUE
Type: TWTY_BOOL
Values: TRUE/FALSE
Default: FALSE
Standard: Yes
Use: Turns printing on and off.
Scanners: All
Container: TWON_ENUMERATION
Type: TWTY_UINT16
Values: i200/i1400: TWPN_LARGECOMIC, TWPN_LARGECINE, TWPN_SMALLCOMIC, TWPN_SMALLCINE
i600/i700/i800/i1800: TWPN_LARGECOMIC, TWPN_LARGECINE, TWPN_LARGECOMIC180, TWPN_LARGECINE180,
TWPN_SMALLCOMIC, TWPN_SMALLCINE, TWPN_SMALLCOMIC180, TWPN_SMALLCINE180
i2900/i3000/i5000: TWPN_LARGECOMIC, TWPN_LARGECINE, TWPN_LARGECOMIC180, TWPN_LARGECINE180,
TWPN_SMALLCOMIC, TWPN_SMALLCINE, TWPN_SMALLCOMIC180, TWPN_SMALLCINE180,
TWPN_BOLDLARGECOMIC, TWPN_BOLDLARGECINE, TWPN_BOLDLARGECOMIC180, TWPN_BOLDLARGECINE180
i4000: TWPN_LARGECOMIC, TWPN_LARGECINE, TWPN_LARGECOMIC180, TWPN_LARGECINE180,
TWPN_SMALLCOMIC, TWPN_SMALLCINE, TWPN_SMALLCOMIC180, TWPN_SMALLCINE180,
TWPN_BOLDLARGECOMIC, TWPN_BOLDLARGECINE
Default: i800/i4000/i5000: TWPN_SMALLCOMIC
Others: TWPN_LARGECOMIC
Standard: No, custom capability
Use: Selects the print font.
CAP_PRINTERFRONTFORMAT
Scanners: i1800
Container: TWON_ENUMERATION
Type: TWTY_UINT16
Values: TWPFF_NORMAL, TWPFF_BLOCK
Default: TWPFF_NORMAL
Standard: No, custom capability
Use: Elects the printer font format to be used.
CAP_PRINTERIMAGEADDRESSFORMAT
Scanners: i800/i1800
Container: TWON_ENUMERATION
Type: TWTY_UINT16
Values: TWPI_DISPLAYLEADINGZEROS, TWPI_SUPPRESSLEADINGZEROS, TWPI_COMPRESSLEADINGZEROS
Default: TWPI_SUPPRESSLEADINGZEROS
Standard: No, custom capability
Use: This selects the format of the image address, if it is selected for printing.
CAP_PRINTERIMAGEADDRESSLEVEL
Scanners: i800/i1800
Container: TWON_ENUMERATION
Type: TWTY_UINT16
Values: TWPL_ALLLEVELS, TWPL_LEVEL1, TWPL_LEVEL2, TWPL_LEVEL3
Default: TWPL_ALLLEVELS
Standard: No, custom capability
Use: This selects which level document the described printing will occur upon.
CAP_PRINTERINDEX
Scanners: All
Container: TWON_RANGE
Type: TWTY_UINT32
Values: 0xFFFFFFFF, 0 - 999999999
Default: i600/i700/i1800: 1
Others: 0
Standard: Yes (TWAIN 1.8)
Use: Sets the print counter.
Notes: 0xFFFFFFFF preserves the current value in the scanner
Scanners: All
Container: TWON_RANGE
Type: TWTY_UINT16
Values: 1 - 9
Default: 0
Standard: No, custom capability
Use: Sets the number of digits of the counter to be printed. Note that the data will be truncated if the number of digits in the count exceeds this value.
CAP_PRINTERINDEXFORMAT
Scanners: All
Container: TWON_ENUMERATION
Type: TWTY_UINT16
Values: TWPI_DISPLAYLEADINGZEROS, TWPI_SUPPRESSLEADINGZEROS, TWPI_COMPRESSLEADINGZEROS
Default: i800: TWPI_SUPPRESSLEADINGZEROS
Others: TWPI_DISPLAYLEADINGZEROS
Standard: No, custom capability
Use: Selects the format used to print the counter.
CAP_PRINTERMODE
Scanners: i4000/i5000
Container: TWON_ENUMERATION
Type: TWTY_UINT16
Values: TWPM_SINGLESTRING, TWPM_COMPOUNDSTRING
Default: TWPM_SINGLESTRING
Standard: Yes (TWAIN 1.8)
Use: TWPM_SINGLESTRING allows the full range of printer features to be expressed.
TWPM_COMPOUNDSTRING follows the guidelines of the TWAIN 1.8 specification.
Scanners: All
Container: TWON_RANGE
Type: TWTY_FIX32
Values: Scanner specific
Default: Scanner specific
Standard: No, custom capability
Use: This selects the position from the top of the page where printing is to begin.
CAP_PRINTERSTRING
Scanners: i2900/i3000/i4000/i5000
Container: TWON_ONEVALUE
Type: TWTY_STR255
Values: Any string (up to 40 characters)
Default: “111”
Standard: Yes (TWAIN 1.8)
Use: This capability is the same as CAP_PRINTERWRITESEQUENCEMESSAGE1.
CAP_PRINTERSUFFIX
Scanners: All
Container: TWON_ONEVALUE
Type: TWTY_STR255
Values: i600/i700/i1800/i5000: Any string (up to 20 characters)
Others: Any string (up to 40 characters)
Default: i200/i600/i700/i1400: “ABC”
Others: “111”
Standard: Yes (TWAIN 1.8)
Use: Specifies a text string to be printed.
CAP_PRINTERTIME
Scanners: i600/i700/i1800/i2900/i3000/i4000/i5000
Container: TWON_ONEVALUE
Type: TWTY_STR255
Values: HH:MM (HH - hour (0-23), MM - minutes (0-59), i.e. 00:00->23:59)
Default: empty string
Standard: No, custom capability
Use: This will set the scanner to a specific time prior to printing. The scanner will be returned to the original time afterwards.
Set to empty string to disable.
CAP_PRINTERWRITESEQUENCE
Scanners: All
Container: TWON_ENUMERATION
Type: TWTY_UINT16
Values: i600/i700/i800/i1800/i5000: TWPW_DATE, TWPW_TIME, TWPW_INDEX, TWPW_MESSAGE1 to 6, TWPW_SPACE
Others: TWPW_DATE, TWPW_TIME, TWPW_INDEX, TWPW_MESSAGE1, TWPW_SPACE
Default: TWPW_INDEX
Standard: No, custom capability
Use: Determines what will be printed.
CAP_PRINTERWRITESEQUENCEMESSAGE1-6
Scanners: All
Container: TWON_ONEVALUE
Type: TWTY_STR255
Values: i600/i700/i1800/i5000: Any string (up to 20 characters), CAP_PRINTERWRITESEQUENCEMESSAGE1 through 6
Others: Any string (up to 40 characters), CAP_PRINTERWRITESEQUENCEMESSAGE1
Default: i200/i600/i700/i1400: “ABC”
Others: “111”
Standard: No, custom capability
Use: Specifies a text string to be printed.
Notes: This one text string can be used anywhere in the print sequence, and more than once.
Same as CAP_PRINTERSUFFIX (CAP_PRINTERSUFFIX is CAP_PRINTERWRITESEQUENCEMESSAGE1)
Scanners: i200/i600/i700/i1400/i1800
Container: TWON_RANGE
Type: TWTY_UINT16
Values: i200/i1400: 1
Others: 1 - 6
Default: 1
Standard: No, custom capability
Use: Sets the current write sequence message.
Notes: Setting this value to 1 selects CAP_PRINTERSUFFIX.
CAP_PRINTERWRITESEQUENCESTRING
Scanners: All
Container: TWON_ONEVALUE
Type: TWTY_STR255
Values: (see the control characters below)
i200/i600/i700: Max 20 control characters
i800/i1800: Max 80 control characters
Others: Max 40 control characters
Default: "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
Standard: No, custom capability
Use: Controls what will be printed.
The Write Sequence capability (CAP_PRINTERWRITESEQUENCESTRING) is used to control what is printed by the scanner, and must adhere to the following rules.
· Value must always be valid, even if disabled
· Embedded ‘Z’s are not allowed
The following list covers the available control characters:
For i800/i1800/i2900/i3000/i4000/i5000 scanners:
· Z - end of write sequence (This is optional and may fill out the string)
· A - IA field A (based on CAP_PRINTERIMAGEADDRESSFORMAT)
· B - IA field B (based on CAP_PRINTERIMAGEADDRESSFORMAT)
· C - IA field C (based on CAP_PRINTERIMAGEADDRESSFORMAT)
· D - IA field D (based on CAP_PRINTERIMAGEADDRESSFORMAT)
· Y - Date (based on CAP_PRINTERDATEFORMAT and CAP_PRINTERDATEDELIMITER)
· T - Time HH:MM (CAP_PRINTERTIME)
· S - Printer Index (CAP_PRINTERINDEX based on CAP_PRINTERINDEXDIGITS and CAP_PRINTERINDEXFORMAT)
· 1 - Message #1 (level 1,2,3) (CAP_PRINTERWRITESEQUENCEMESSAGE1)
· 2 - Message #2 (level 1,2,3) (CAP_PRINTERWRITESEQUENCEMESSAGE2)
· 3 - Message #3 (level 1,2,3) (CAP_PRINTERWRITESEQUENCEMESSAGE3)
· 4 - Message #4 (level 1,2,3) (CAP_PRINTERWRITESEQUENCEMESSAGE4)
· 5 - Message #5 (level 1,2,3) (CAP_PRINTERWRITESEQUENCEMESSAGE5)
· 6 - Message #6 (level 1,2,3) (CAP_PRINTERWRITESEQUENCEMESSAGE6)
· 1 - Message #7 (all levels) (CAP_PRINTERWRITESEQUENCEMESSAGE7)
· 2 - Message #8 (all levels) (CAP_PRINTERWRITESEQUENCEMESSAGE8)
· 3 - Message #9 (all levels) (CAP_PRINTERWRITESEQUENCEMESSAGE9)
· 4 - Message #10 (all levels) (CAP_PRINTERWRITESEQUENCEMESSAGE10)
· 5 - Message #11 (all levels) (CAP_PRINTERWRITESEQUENCEMESSAGE11)
· 6 - Message #12 (all levels) (CAP_PRINTERWRITESEQUENCEMESSAGE12)
· “ “ - Blank space (1 character)
For i200/i600/i700/i1400 scanners:
· Z - End of write sequence (This is optional and may fill out the string)
· C - Printer index (CAP_PRINTERINDEX based on CAP_PRINTERINDEXDIGITS and CAP_PRINTERINDEXFORMAT)
· D - Date MMDDYYYY (based on CAP_PRINTERDATEDELIMITER)
· E - Date DDMMYYYY (based on CAP_PRINTERDATEDELIMITER)
· F - Date YYYYMMDD (based on CAP_PRINTERDATEDELIMITER)
· J - Date YYYYDD (based on CAP_PRINTERDATEDELIMITER)
· H - Date DDD (based on CAP_PRINTERDATEDELIMITER)
· T - Time HH:MM (CAP_PRINTERTIME)
· B - Blank space (1 character)
· S - Message #1 (CAP_PRINTERWRITESEQUENCEMESSAGE1 or CAP_ PRINTERSUFFIX)
· 2 - Message #2 (CAP_PRINTERWRITESEQUENCEMESSAGE2)
· 3 - Message #3 (CAP_PRINTERWRITESEQUENCEMESSAGE3)
· 4 - Message #4 (CAP_PRINTERWRITESEQUENCEMESSAGE4)
· 5 - Message #5 (CAP_PRINTERWRITESEQUENCEMESSAGE5)
· 6 - Message #6 (CAP_PRINTERWRITESEQUENCEMESSAGE6)
CAP_PRINTERENABLED: TRUE
CAP_PRINTERDATEFORMAT: TWPE_MMDDYYYY
CAP_PRINTERDATEDELIMITER: TWPD_FORWARDSLASH
CAP_PRINTERFONT: TWPN_SMALLCOMIC
CAP_PRINTERINDEX: 20
CAP_PRINTERINDEXDIGITS: 5
CAP_PRINTERINDEXFORMAT: TWPI_DISPLAYLEADINGZEROS
CAP_PRINTERPOSITION: 2.5 inches
CAP_PRINTERWRITESEQUENCEMESSAGE1: “Message1”
CAP_PRINTERWRITESEQUENCEMESSAGE2: “Message2”
CAP_PRINTERWRITESEQUENCEMESSAGE3: “Message3”
CAP_PRINTERWRITESEQUENCEMESSAGE4: “Message4”
CAP_PRINTERWRITESEQUENCEMESSAGE5: “Message5”
CAP_PRINTERWRITESEQUENCEMESSAGE6: “Message6”
CAP_PRINTERWRITESEQUENCESTRING: “Y T 1 2 3 4 5 6 SZZZZZZZZZZZZZZZZZZZZZZZ”
Result: Top Printer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
“12/06/2010 10:25 Message1 Message2 Message3 Message4 Message5 Message6 00020”
“12/06/2010 10:25 Message1 Message2 Message3 Message4 Message5 Message6 00021”
“12/06/2010 10:25 Message1 Message2 Message3 Message4 Message5 Message6 00022”
CAP_PRINTERENABLED: TRUE
CAP_PRINTERDATEFORMAT: TWPE_MMDDYYYY
CAP_PRINTERDATEDELIMITER: TWPD_FORWARDSLASH
CAP_PRINTERFONT: TWPN_SMALLCOMIC
CAP_PRINTERINDEX: 20
CAP_PRINTERINDEXDIGITS: 5
CAP_PRINTERINDEXFORMAT: TWPI_DISPLAYLEADINGZEROS
CAP_PRINTERPOSITION: 2.5 inches
CAP_PRINTERWRITESEQUENCEMESSAGE1: “Message1”
CAP_PRINTERWRITESEQUENCESTRING: “Y T S 1ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ”
Result: Top Printer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
“06/22/2012 10:25 00020 Message1”
“06/22/2012 10:25 00021 Message1”
“06/22/2012 10:25 00022 Message1”
CAP_PRINTERENABLED: TRUE
CAP_PRINTERDATEDELIMITER: TWPD_HYPHEN
CAP_PRINTERDATEFORMAT: TWPE_YYYYMMDD
CAP_PRINTERFONT: TWPN_SMALLCOMIC
CAP_PRINTERIMAGEADDRESSFORMAT: TWPI_SUPPRESSLEADINGZEROS
CAP_PRINTERIMAGEADDRESSLEVEL: TWPL_LEVEL1
CAP_PRINTERINDEXDIGITS: 9
CAP_PRINTERINDEXFORMAT: TWPI_DISPLAYLEADINGZEROS
CAP_PRINTERPOSITION: 0.5 inches
CAP_PRINTERWRITESEQUENCEMESSAGE1: “Level-1”
CAP_PRINTERWRITESEQUENCEMESSAGE2: “Level-2”
CAP_PRINTERWRITESEQUENCEMESSAGE3: “Level-3”
CAP_PRINTERWRITESEQUENCEMESSAGE4: “.”
CAP_PRINTERWRITESEQUENCEMESSAGE5: “”
CAP_PRINTERWRITESEQUENCEMESSAGE6: “”
CAP_PRINTERWRITESEQUENCESTRING: “1BYZZZZZZZZZZZZZZZZZ
2BSZZZZZZZZZZZZZZZZZ
3BA4B4C4DZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZ”
Result: Level Top Printer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Level-0 “Level-2 000000009”
Level-1 “Level-1 2002-02-25”
Level-1 “Level-1 2002-02-25”
Level-3 “Level-3 FIXED.2.1.1”
Level-0 “Level-2 000000013”
Level-1 “Level-1 2002-02-25”
Level-1 “Level-1 2002-02-25”
Level-3 “Level-3 FIXED.3.1.1”
Level-0 “Level-2 000000017”
CAP_PRINTERENABLED: TRUE
CAP_PRINTERFONT: TWPN_LARGECOMIC
CAP_PRINTERWRITESEQUENCESTRING: “SBDBTBCZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ”
CAP_PRINTERWRITESEQUENCEINDEX: 7
CAP_PRINTERSUFFIX: “Test”
CAP_PRINTERDATEDELIMITER: TWPD_FORWARDSLASH
CAP_PRINTERINDEX: 10
CAP_PRINTERINDEXDIGITS: 4
CAP_PRINTERINDEXFORMAT: TWPI_DISPLAYLEADINGZEROS
CAP_PRINTERPOSITION: 1 inch
Result: Top Printer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
“Test 03/19/2001 11:30 0010”
“Test 03/19/2001 11:30 0011”
“Test 03/19/2001 11:30 0012”
CAP_PRINTERENABLED: TRUE
CAP_PRINTERFONT: TWPN_LARGECOMIC
CAP_PRINTERWRITESEQUENCESTRING: “FBSBCB1ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ”
CAP_PRINTERWRITESEQUENCEMESSAGE1: “Scanner-05”
CAP_PRINTERWRITESEQUENCEMESSAGE2: “Testing”
CAP_PRINTERDATEDELIMITER: TWPD_NONE
CAP_PRINTERINDEX: 9
CAP_PRINTERINDEXDIGITS: 8
CAP_PRINTERINDEXFORMAT: TWPI_SUPPRESSLEADINGZEROS
CAP_PRINTERPOSITION: 1 inch
Result: Top Printer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
“20010319 Scanner-05 9 Testing”
“20010319 Scanner-05 10 Testing”
“20010319 Scanner-05 11 Testing”