Scan to PDF using blank sheets as separators in VB

A sample application using TwainControlX

This example shows how to scan a batch of pages using an automatic document feeder (ADF), dividing the pages into multiple PDF documents for saving. Blank sheets of paper are inserted between the pages to indicate where one file should end and the next should begin.

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

Trial version of the ActiveX control TwainControlX. (1.5MB)

Zip file of VB demo project. (3kB)

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

Before running the project, load the ADF of your scanner with several pages. The pages should include some blank white sheets to divide the remaining pages into separate documents.

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 the 'Acquire' button.

The scanner will feed pages and scan them until none remain. After each image is acquired, the code in 'Twain1_OnAcquire' will run. This will check whether the page is blank using the boolean IsBlank property. If the page is not blank, it will be added to the current PDF document and displayed on the form. If it is blank, the PDF will be written and a new one will be started.

The files will be saved in the default working directory for VB, so edit the code to specify a different path if you want to save them somewhere else.