Using the Bulk Scanner

The OMR Mark Engine installation package includes a bulk scanning application known as the bulk scanner. This application’s primary intent is to provide an easy to use “end-user” tool integrating the scanner engine. It allows a user to “run” a form scanning batch without having the template designer.

The bulk scanner will, by default, scan forms and then perform whatever script task is assigned to the template.

Scripting the Output

In order to store the output from a bulk-scan operation you’ll need to hook into the scripting capabilities of the scan templates. Since the bulk scanner provides no way to “Save” the output of the scan, each template will have to dictate what action should be taken upon successful completion of scan. This can be :

  • Saving the output of the scanned page to a CSV or XML file
  • Pushing the results to a web-service

Either way it will require a little bit of C# script (Note: It should be noted that I am not yet using the Roslyn scripting API and users should only scan images from templates from a source they trust).

A script in the template is easy enough to write, simply add a <script> tag to the template and write some C# code. The following is an example of a script which will store the output of a form in a CSV C:\Temp\censusData.csv.

 

  <script>
        <![CDATA[
        // Save the file as CSV format
        String filePath = Path.Combine("C:\\temp\\censusData.csv");       
        Trace.TraceInformation("Saving to {0}", filePath);
        CsvOutputTransform transform = new CsvOutputTransform();
        OmrPageOutputCollection pageCollection = new OmrPageOutputCollection();
        pageCollection.Pages.Add(page);
        using(FileStream fs = File.Open(filePath, FileMode.Append))
        {
            byte[] data = transform.Transform(page.Template, pageCollection);
            fs.Write(data, 0, data.Length);
        }
        ]]>
    </script>
</template>

 

 

Deploying the Template

Currently the bulk scanner will use the barcode guides on a scanned sheet to match a scanned form to a template. To do this it expects a file named “ID.mxml” to be placed in the application directory matching the ID of the form identified in the scan. For example, the following barcode:

Placed on the form would require that a file called “CENSUS.MXML” be placed in the application directory.

Running the Scan

To run the scan, simply launch the Bulk Scanner application, select the scanner and press “Start Scan”. If your scanner is a sheetfed scanner then all the forms in the feeder tray will be consumed.

image

Once the scan is complete, you will receive a list of all successfully scanned objects which can be reviewed in the case of an error.

image

Last edited Apr 20, 2015 at 12:56 PM by fyfesoftware_oss, version 2