ciansoft.com
Home
Products
Contact us
Site Map
Scanning to a multi-page TIFF file in VB

A sample application using TwainControlX

This example shows how to acquire a series of images from a TWAIN device and save these images as a single multi-page TIFF file. This can be done either using an Automatic Document Feeder (ADF) or by scanning single pages and building the file one image at a time.

To use this demo, you will need to download two files:

Trial version of the ActiveX control TwainControlX. (788kB)

Zip file of VB demo project. (4kB)

Install TwainControlX, then extract the VB demo files from tcx_mult2.zip. Open Visual Basic, and open the project TCX_Mult2.vbp.

The project consists of a single form, fMain. All the code is included in this form, there are no other modules. Run the project and click one of the three buttons.

The first button starts acquiring images in MultiImage mode. This normally requires a scanner with an ADF, but can also be possible with some webcams. When all images have been acquired, a multi-page TIFF file is saved (C:\Multi.tif).

The second or third buttons start acquiring images one at a time. After each one, a message box asks the user whether to continue or to stop. The AddToTIF or InsertTIF commands are used to build a multi-page TIFF file from the individual images.

After each image is acquired, the code in 'Twain1_OnAcquire' will run. This displays the current image in a VB Image control.

Default settings for the image size and resolution will be used. This usually means that the image is too big to display in the Image control, so only the top left portion of the image will be seen on screen. The whole image will be saved to file.

Multi-page PDF files can be created instead of TIFF files by modifying the code and replacing TIFF functions with the corresponding PDF functions, i.e., replace AddToTIF with AddToPDF, WriteTIF with WritePDF etc.

User Manual - FAQ - Purchase TwainControlX