Scan to PDF using blank sheets as separators in VB.NET

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.NET demo project. (18kB)

Install TwainControlX, then extract the VB.NET demo files from TCXMult3VBNET.zip, keeping the same directory structure. Start VB.NET, and open the project in solution file 'TCX_Mult3_VBNET\TCX_Mult3_VBNET.sln'.

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.

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 'AxTwain1_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.


Note that the demo has been prepared using the 2010 version of VB. For a copy of the demo compatible with older versions of VB.NET download the following ZIP file:

Zip file of demo project for older VB.NET versions. (30kB)