ImageControls

 

ImageControls 3 Application Note

IC Toolkit 3.1 is the most recent release of the ImageControls Toolkit.


If you are running a previous version of Kofax ImageControls, refer to the ImageControls How to Buy Web page for details on how to obtain the appropriate ImageControls 3 release for your configuration.


Printing Multi-page TIFF Files

In the last issue of this newsletter we demonstrated how to scan to Multi-page TIFF files. In this issue we will show how to utilize the new ImageControls KPrnt control to print Multi-page TIFF files. The source code shown here was written to take advantage of some of the new features in Visual Basic 4.0 such as the 'With' statement. Open a new Visual Basic project and add a Common Dialog control, SSPanel control, KPrnt control to a form. Create a control array of Command buttons as shown below.

 In the Form's declaration section declare a couple of variables for global use:

Dim g_FileName As String

Dim g_Counter As Integer

Open the Form QueryUnload event and enter the following code:

'***** Prevent exit of program if printer is busy

If KPrnt1.Busy = True Then

MsgBox "Cannot exit while printer is busy"

Cancel = True

End If

Open the Command1 Click event and add the following code:

Select Case Index

Case 0

With CommonDialog1

.DialogTitle = "Select a file to print"

.Flags = cdlOFNFileMustExist Or cdlOFNHideReadOnly

.Filter = "TIFF (*.tif)|*.tif"

.CancelError = True

On Error Resume Next

.ShowOpen

'***** If Cancel is pressed then do nothing

If Err = 32755 Then

Exit Sub

End If

g_FileName = .filename

End With

SSPanel1.Caption = ""

KPrnt1.DeviceMethod = KPDEVICEMETHODBATCH

KPrnt1.Action = KPACTIONSTART

Case 1

KPrnt1.Action = KPACTIONSTOP

SSPanel1.Caption = "Action Stop initiated"

Case 2

Unload Me

End

End Select

Note the use of the 'With' statement above. Open the KPrnt1 BatchStart event and initialize the page counter:

'***** Initialize the global page counter

g_Counter = 1

Finally, open the KPrnt1 PageStart event and enter the following code:

KPrnt1.PSFileName = g_FileName

If g_Counter > KPrnt1.PSPageCount Then

KPrnt1.PSFileName = ""

SSPanel1.Caption = Str$(g_Counter - 1) & " Page(s) printed"

Else

SSPanel1.Caption = "Page" & Str$(g_Counter)

KPrnt1.PSPage = g_Counter

End If

g_Counter = g_Counter + 1

DoEvents

When you run the program, you will first select a file to print. The KPACTIONSTART is then initiated and images will be sent to the printer until the last page in the file is printed. 

Back To Top

Kofax ImageControls Support

The Kofax ImageControls support group is skilled in Visual Basic and Visual C++ development and can assist developers in building their custom imaging applications. Our engineers can also point developers to source code samples on the Kofax FTP site.

The ImageControls 3 Technical Support Web pages have been kept up to date. We encourage ImageControls developers to investigate the information in these Web pages before looking for other sources of support. Use the menu options in the upper left side of this page to access additional product support Web pages for this product.


For details regarding technical support available for all Kofax products, please review the current Support Overview & Options and Product Support Eligibility Matrix Web pages.