tags:

views:

479

answers:

1

I am trying to use Kofax Capture api and trying to write a custom module which will do a scan. For it i require to create a batch and then process/scan it.

Is there anyway to process/scan a batch??

+2  A: 

Hmm, I don't know if it's possible to do inside a custom module. When writing a custom module you're typically using the Kofax Capture Optimized Custom Module API (DBLiteOpt.dll). I know you can create an empty batch with a custom module by using BatchCreate method of the RuntimeSession object:

'*** Get your Process Id
pid = m_oLogin.ProcessId '*** Create new batch
Set m_oBatch = m_oRuntimeSession.BatchCreate("SomeBatchClass", "MyBatch", pid)

Unfortunately, I don't know of any way to import documents into that batch.

You can always just create a stand-alone program that imports a batch. Here's some C# pseudo-code:

Kofax.AscentCaptureModule.ImportLogin myLogin ;
Kofax.AscentCaptureModule.Application myApp;

// login first
myLogin = new Kofax.AscentCaptureModule.ImportLogin() ;
myApp = myLogin.Login("myUsername", "myPassword") ;

// create a new batch 
Kofax.AscenCaptureModule.BatchClass myBatchClass =
myApp.BatchClasses["MyBatchClassName"];
Kofax.AscentCaptureModule.Batch = 
myApp.CreateBatch(ref myBatchClass, "TheNameOfMYBatch");

// create a new document and set its form type
Kofax.AscentCaptureModule.Document myDoc ;
Kofax.AscentCaptureModule.Page myPage = null ;
myDoc = myBatch.CreateDocument(null) ;
Kofax.AscentCaptureModule.FormType myFormType = 
myBatch.FormTypes[1] // - just hardcoded a form type here
myDoc.set_FormType(ref myFormType) ;

// add some pages to the doc
Kofax.AscentCaptureModule.Pages myPages = myBatch.ImportFile("SomeFilePath") ;
foreach(Kofax.AscentCaptureModule.Page myPage in myPages)
{
     myPage.MoveToDocument(ref myDoc, null) ;
}

myApp.CloseBatch() ;
Brian
UPDATE: It is definitely possible to create a new batch and import pages into inside a custom module. You can't do it with just the Optimized Custom Module API though - you'll need to use the Kofax Capture Document Access library (DBLite.dll).
Brian